Closed HenrikBengtsson closed 6 years ago
How about this:
If R_BATCHTOOLS_TEMPLATE
is set, exactly this template will be used in findTemplateFile()
.
If R_BATCHTOOLS_CONFIG
is set, exactly this file will be used in findConfFile()
.
Is there a use case where setting the search path has a benefit?
That works too.
The only reason why I propose R_BATCHTOOLS_SEARCH_PATH
was that the advantage with a search path is that it's invariant to the type of scheduler (the {{name}}
) part so that the latter only has to be specified in one place. With R_BATCHTOOLS_TEMPLATE
you have to specify {{name}}
in both the env var and the R code. The disadvantage with R_BATCHTOOLS_SEARCH_PATH
is that it's not clear whether it should look for batchtools.{name}.tmpl
or .batchtools.{name}.tmpl
.
The advantages with R_BATCHTOOLS_TEMPLATE
and R_BATCHTOOLS_CONFIG
are that then those files can be located in different folders and it is more straightforward to explain what they do.
Does #156 work for you?
Awesome. That looks great.
I ran into a interesting use case where I am not in full control of what the current working directory is when launching batchtools jobs (it's in an R temporary folder of spawned R process that is spawned by yet another R process). This prevents me from using a
batchtools.{name}.tmpl
in the working directory (of the grandparent R process). The only solution found was to use a user-account global template file, e.g.~/.batchtools.{name}.tmpl
.Would it make sense to add
R_BATCHTOOLS_SEARCH_PATH
(env var that I can control) to the search path wherebatchtools:::findTemplateFile()
looks forbatchtools.{name}.tmpl
? The same idea / question could then be applied tobatchtools:::findConfFile()
as well.