
On 10/17/2014 02:47 PM, John Chilton wrote:
In theory GALAXY_SLOTS is now always set unless Galaxy is pretty old - I still think it is important for tools to specify defaults using the \${GALAXY_SLOTS:-4} idiom so that tools themselves don't have explicit dependencies on the Galaxy runtime and in case new resource managers or job runners come along that don't set this.
That said - I figured someday someone would ask this question so there is indeed undocumented magic to determine if the number of slots has been configured explicitly to 1 or if that is just the fallback because it was left unspecified or Galaxy didn't know how to determine it from the resource manager.
The magic environment variable is GALAXY_SLOTS_CONFIGURED - if that is set and GALAXY_SLOTS is 1 - Galaxy believes that the number of requested cores is truly and explicitly 1. If GALAXY_SLOTS is 1 and GALAXY_SLOTS_CONFIGURED is not set - Galaxy is just supplying the default of 1 to the tool because it doesn't know what else to do. (1 is used by the local runner if local_slots is not set i job_conf or used by all the other job runners if they cannot figure out what the environment is requesting).
I don't know how actionable it is from a tool author perspective - but I did think it was important to track it. Hope this helps.
Hi John, This is great ! I think it is very actionable for my case. I would just overwrite my tool's internal configuration with GALAXY_SLOTS if it is set and if GALAXY_SLOTS > 1 or (GALAXY_SLOTS == 1 and GALAXY_SLOTS_CONFIGURED is set). Much better than having to guess for the == 1 case, thanks! Have a nice weekend, Wolfgang