
On 10/17/2014 10:39 AM, Peter Cock wrote:
On Thu, Oct 16, 2014 at 11:05 PM, Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> wrote:
Hi,
this is just to make sure: the GALAXY_SLOTS environmental variable set by Galaxy when running tools will always be a number >= 1 with 1 being the default if nothing else is configured in the job runner settings ?
Correct ?
Thanks, Wolfgang
Hi Wolfgang,
I believe so, however it is possible it might be unset in a corner case (please report this as a bug if you see it happen) or a tool could change the value.
You can use the following bash syntax to set your own default in the tool's <command> template, e.g.
-num_threads "\${GALAXY_SLOTS:-8}"
Note the colon minus is the special bash syntax, here the default value is 8 (not minus 8) if $GALAXY_SLOTS is not set. Also note in the <command> XML you must escape the dollar sign.
Peter
Hi Peter, thanks for confirming. I'm not particularly worried about it being absent. My use-case is own software that has its own threading config settings, but when run in Galaxy should respect $GALAXY_SLOTS. To do this, it's checking for the presence of the environmental variable and gives it precedence over its own config. What would be problematic though is if in certain situations GALAXY_SLOTS could be "0" or a negative number or something that can't be cast to an int, but Björn's and your answer imply that this won't happen. By the way, there's one exception from the above precedence rule that I'm planning to implement: if GALAXY_SLOTS defaults to "1", I'll use the config settings instead, essentially giving users the choice if they prefer configuration from Galaxy or from the tool side. Do you think this is a good idea ? Best, Wolfgang