Problems defining "submit:"/using a custom script w/MATLAB form.yml

Hi there. I’m attempting to configure a new MATLAB app in much the same way I set up the Desktop app, integrating a Singularity container to provide the MATE desktop environment. Here’s what I’m referring to:

At the top of my form, I include:

submit: submit/container.yml.erb

Where I run into a snag I guess is where to place a modified version of script.sh.erb in /etc. When I go to launch the app, it fails because I don’t have a module called xalt/latest. I have my own copy of script.sh.erb in /etc/ood/config/apps/bc_osc_matlab/submit/template, and have also tried it in /etc/ood/config/apps/bc_osc_matlab/template. Am I misunderstanding how this works?

I’m attempting to use the MATLAB app as-is and modify it via configs overlayed in /etc/ood/config/apps/bc_osc_matlab, in essence, so that if there’s a new version, I don’t need to merge code together, etc.

The docs explain how to sandbox one of the example apps, but from what I’ve noticed, not really the best practices for installing/configuring one that goes into /var/www/ood/apps/sys.

Thanks in advance for the help.

Hello and welcome!

Those posts are quite long so I apologize ahead of time if I’m missing something. The locations to set and place the files should be covered here: 4. Custom Job Submission — Open OnDemand 2.0.20 documentation

So you could use whatever path you like, it just needs to match what your cluster.yml has for the location in that root app location you are working in, here bc_osc_matlab.

Is the script.sh.erb set to install that xalt/latest module?

No, it doesn’t install that module. So what I did:

Set up /etc/ood/config/apps/bc_osc_matlab, and include a form.yml, which has submit: submit/container.yml.erb and then reused that file from my bc_desktop instance, which works great for that app. After discovering this problem, I also copied script.sh.erb to where I thought it needed to go under the app directory above – trying the root of that directory, and submit and templates and removed the reference to xalt/latest because we don’t currently have it installed.

What’s very unclear to me is where OOD will look for script.sh.erb. The only reference to it anyplace is the %s in my container.yml.erb (at least that’s what I assume %s does):

[root@amarel-test2 bc_osc_matlab]# cat submit/container.yml.erb 
<%
  image="/projects/community/containers/mate_desktop-centos-7.9-login.sif"
%>
---
script:
  <%-
     extra_slurm_args = extra_slurm_options.split
  -%>
  reservation_id: "<%= reservation_id %>"
  native:
    - "-c"
    - "<%= num_cores.blank? ? 1 : num_cores.to_i %>"
    - "--mem=<%= memory_gigs %>G"
  <%- unless extra_slurm_options.empty? -%>
    <%- extra_slurm_args.each do |slurm_arg| -%>
    - "<%= slurm_arg %>"
    <%- end -%>
  <%- end -%>
  template: "vnc"
batch_connect:
  script_wrapper: |
    cat << "CTRSCRIPT" > container.sh
    export PATH="$PATH:/opt/TurboVNC/bin"
    %s  
    CTRSCRIPT
 
    module purge
    module load singularity/3.8.5

    #export SINGULARITY_BINDPATH="/run/munge:/run/munge,/tmp/$ID:/run/user,/projects,/scratch,/cache/sw:/opt/sw,/cache,/cache/home:/home,/projectsp,/projectsn,/projectsc,/etc/slurm"
    export SINGULARITY_BINDPATH="/run,/projects,/scratch,/cache/sw:/opt/sw,/cache,/cache/home:/home,/projectsp,/projectsn,/projectsc,/etc/slurm"

    singularity exec <%= image %> /bin/bash container.sh

This question is about the MATLAB app in particular, but is very similar to:

https://discourse.openondemand.org/t/reusing-singularity-vnc-bc-desktop-configuration-in-apps/1882/7

…because that’s really what I’m trying to do.

You should place the script.sh.erb in the bc_osc_matlab/template directory, but you mentioned you had tried that already.

But, looking at that post, it seems like it did run, and threw an error about the xalt/latest module missing? Sorry, I’m still trying to piece the sequence together you are describing.

So, you at one point had the script in bc_osc_matlab/template/script.sh.erb and when you clicked the launch button, it threw an error about missing the xalt/latest module?

What happens now that you removed that xalt/latest reference with the file in that template directory and you try to launch?

Hey sorry, I just realized you are trying to do a sub app and not a straight install.

You won’t be able to override that script.sh.erb that is already in the main matlab app, so that’s why you haven’t been able to get that to work. You can override the submit and form but the script can’t be.

The other thing to note is I believe that etc/ood/config/app path should be /etc/ood/config/apps.

It seems to me that it’s still using the /var/www/ood/apps/sys/bc_osc_matlab/script.sh.erb, since my copy does not contain the xalt/latest module. Maybe I’ll put something in the scripts that makes it very clear which one is in use.

Now that I know at least where it’s supposed to go, that is going to help. Can I, in general, put any given file in the exact same place in /var/www/ood/apps/sys/<app_dir> or /etc/ood/config/apps/<app_dir> and expect that to work?

Sorry for the confusion, please see my correction above.

You are correct that it will only use that script.sh.erb from the main matlab app, I apologize for any confusion.

You can override the submit and form using the /etc/ood/config/apps as you said, but that script from the main app you are trying to sub-app won’t work.

I hope that makes it more clear, and again I’m very sorry about the confusion.

OK, thanks! That clears it up.

Yeah, re: apps my S key has been flaky lately; the typo is in the message, not the actual config (fixed it above).

Sorry about my shoddy description too – I started to post all of my config and by the time I redacted what I didn’t need to put in a public forum, it seemed easier to just describe.

What I’m primarily after is to have it be easier to do local modifications without changing the code of the app much. I can do it with patches or something instead, but so far I’ve gotten lucky I guess with the desktop app and have been able to deal with it entirely through script_wrapper or the like.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.