mschubert / clustermq

R package to send function calls as jobs on LSF, SGE, Slurm, PBS/Torque, or each via SSH
https://mschubert.github.io/clustermq/
Apache License 2.0
146 stars 27 forks source link

docs: add info on exporting functions #220

Closed nick-youngblut closed 3 years ago

nick-youngblut commented 3 years ago

Maybe I missed it, but it appears that the user guide and the Q() function docs don't state that functions can be exported. For example:

library(clustermq)
.fx = function(x) x ** 2
fx = function(x, y) .fx(x) * 2 + y
tmpl = list(job_time = '00:05:00', job_mem = '8G', log_file = 'test.log')
Q(fx, x=1:3, const=list(y=10), export=list(.fx=.fx), n_jobs=3, job_size=1, template=tmpl)

Adding explicit info in the docs about exporting functions will help users who are calling stacked functions as in the example.

mschubert commented 3 years ago

I thought this was self-evident, because functions are just objects of type function in R.

But maybe that's not clear for all users, do you have a suggestion where you would add it?

nick-youngblut commented 3 years ago

Maybe after the first example of export in the user guide? Specifically, after the example at:

If a function relies on objects in its environment that are not passed as arguments, they can be exported using the export argument

mschubert commented 3 years ago

Amended, thanks!