I have to add some environment variables to a modu...
# modules
f
I have to add some environment variables to a module to limit the amount of cpu it can access. What is the preferred way to do this? Can I simply add
export OMP_NUM_THREADS=${task.cpus}
to the script block? https://github.com/MouseLand/cellpose/blob/90da76eb3a3e7b026f07d50333e0c964badae8e2/docs/faq.rst?plain=1#L61
n
IMO
OMP_NUM_THREADS=${task.cpus} <tool>
is better as it will only apply to that tool and will not set this variable on the environment 😛
But it shouldn't matter that much for Nextflow processes I think
m
Check if Nicolas's suggestion works, but you need to be careful if it's something like python script calling another command or something, in which case you need the
export
in order for the subshell that's executing the process to use that value too.
🎉 1
f
Yes thanks you two! I will go with exporting in the script block. No problem with assigning directly
task.cpus
right? I don't have to assign that with a def and elvis operator first because it will always be available?!
f
Amazing, thanks @Mahesh Binzer-Panchal!
👍🏽 1
Since you have already thought about it: https://github.com/nf-core/modules/pull/7474
✅ 1