Interactive App: Passing form.yml.erb value to script_wrapper in submit.yml.erb

Hi,

I am working on Open OnDemand Interactive App that uses Apptainer.

In the file form.yml.erb there is a string Attribute that is location of config file I want to bind to the Apptainer image (e.g., APP_CONFIG).

In submit.yml.erb in batch_connect I use script_wrapper where I start the Apptainer image:

batch_connect:
  template: vnc
  set_host: "host=$(hostname)"
  script_wrapper: 
    ...
    %s
    ...
     apptainer exec -B "<%= APP_CONFIG %>"/config.sh:/opt/config.sh <%= image %> /bin/bash container.sh

However, I haven’t been able to successfully pass the value of APP_CONFIG to Apptainer this way.

When I use
<%= APP_CONFIG %>/config.sh,
I get an error:
uninitialized constant BatchConnect::SessionContext::APP_CONFIG.

If I use
<%= context.APP_CONFIG %> instead,
I get the error:
undefined local variable or method context for #<BatchConnect::SessionContext:0x00007f871cc163f8>.

I have tried different combinations as well - passing the value of APP_CONFIG with %{APP_CONFIG}, declaring variable at the beginning of the file and use it as ${app_config}, etc., but haven’t been able to make this work in the submit.yml.erb file.

Can you please let me know what I am missing and advise me on how to achieve this correctly?

We have Open OnDemand 2.0.32 on our cluster.
Please let me know if you need any additional information.

Thank you,
Natasha

I’d guess it’s lowercase app_config.

Does this work? (also be careful with quoting there that may turn out to be "/foo/bar"/config.sh in BASH.

@jeff.ohrstrom , thank you so much for your prompt reply and help! I had the variables in the Form in upper case letters, and after I switched to lower case letters, I was able to use them in the file submit.yml.erb.

Glad to hear it! Also you should look into the vnc_container template that was added to accommodate what you’re trying to do.

https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/vnc-container-bc-options.html