mschubert / clustermq

R package to send function calls as jobs on LSF, SGE, Slurm, PBS/Torque, or each via SSH
https://mschubert.github.io/clustermq/
Apache License 2.0
146 stars 27 forks source link

SSH: Specify remote scheduler template #122

Closed pat-s closed 5 years ago

pat-s commented 5 years ago

When using the SSH way, the scheduler template specified in the default remote R interpreter is used. Is there a way to set a custom path (preferred locally) to a scheduler template which should be used on the remote machine?

Use case: Deploy jobs of different projects (with different scheduler settings) using the SSH way. Currently the only way to do this is to manually update/edit the path to the template in .Rprofile of the default R interpreter on the HPC (unless I overlooked something :horse: ).

mschubert commented 5 years ago

You are right, this is currently not possible.

One way to support this would be to add an SSH template instead of hardcoding the commands, where you could supply the R_PROFILE_USER environment variable and thus set any option you want.

Another option might be to pass the clustermq.defaults variable via SSH.

Can you expand a bit on your use case? Like, are there different queues per project?

pat-s commented 5 years ago

I think option 2) might be more intuitive for the user.

Use case

Send jobs of different projects via SSH. Each project has it's packrat library and (potentially) a different R version.

So to use a project specific packrat library, one needs to start R from the root of the project directory with the correct R version.

These commands (usually a simple cd and module load <R interpreter>) are set in the slurm_clustermq.tmpl file. However, currenltly always the template specified in the default R interpreter is chosen. I would like to be able to point to a specific template file when using the SSH approach.

This is already possible when directly initializing from the frontend because then a project specific .Rprofile can be used which again points to a custom template file. This custom .Rprofile also loads packrat and a specific R version.

mschubert commented 5 years ago

@pat-s I now moved the SSH command to a template with the latest develop.

You should be able to

#5 
"cd {{ project_dir }} && R --no-save --no-restore -e [...]"

I'm not sure if I want to pass defaults via SSH, because the user also may want different defaults for different machines (and this would override it).

mschubert commented 5 years ago

Similarly, a custom template can be used with options set from the environment variable R_PROFILE pointing to an R profile file.

pat-s commented 5 years ago

@mschubert Thanks a lot for this feature!