Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singularity does not automatically bind current working directory #10

Open
kubu4 opened this issue Jul 15, 2022 · 3 comments
Open

Singularity does not automatically bind current working directory #10

kubu4 opened this issue Jul 15, 2022 · 3 comments

Comments

@kubu4
Copy link

kubu4 commented Jul 15, 2022

As noted in Issue #9 , this can be inelegantly solved by the user editing the Singularity system config file and then starting the pipeline.

However, I think the pipeline should automatically bind the working directory. This is especially important for users who do not have permissions to allow them to edit the Singularity system config file.

@bio15anu
Copy link
Member

bio15anu commented Jul 18, 2022

Thanks very much for the investigatory work! This looks like it is system-specific and so only relevant on a case-by-case basis depending on how singularity has been configured and installed for each user.

I think in your case the best solution would be to create a new configuration file called config in your nextflow system directory (usually ~/.nextflow) and in there add the following options:

singularity {
autoMounts = true
runOptions = "--bind /home/shared/8TB_HDD_01"
}

These settings will then apply globally to all Nextflow pipelines run by you on your system which make use of singularity, without need to edit the /etc/singularity/singularity.conf file.

This is based on the troubleshooting from nf-core that you found, and the singularity config scope here:
https://www.nextflow.io/docs/latest/config.html#config-singularity

and the steps in singularity manual here:
https://docs.sylabs.io/guides/3.0/user-guide/bind_paths_and_mounts.html#user-defined-bind-paths

@kubu4
Copy link
Author

kubu4 commented Jul 18, 2022

Thanks for the follow up.

Is there anyway to automate this process where the current working directory could be added as a binding, upon initiation of the pipeline?

If other users try to run this pipeline in a different directory on this computer, then we'll constantly need to customize config files. Our lab has a wide range of user expertise and troubleshooting and/or customizing config files might be beyond the abilities of some members.

@bio15anu
Copy link
Member

Yes, sure thing. You can change the runOptions line to e.g. "--bind ${launchDir}" and then in this case the path /home/shared/8TB_HDD_01/sam/analyses/epidiverse-wgbs-text would be automatically passed to the Singularity launcher.

You can then share the config file with all your users, who should save it as $HOME/.nextflow/config (not nextflow.config as I said originally above - my mistake, I edited it now). The config will apply globally and the path will change dynamically depending on where exactly in the file system each user starts the pipeline from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants