Skip to content
Prev 5530 / 12125 Next

[R-pkg-devel] [External] Guidelines on use of snow-style clusters in R packages?

The basic principle I would follow is to make sure your code only goes
parallel with explicit permission from the end user. One way to do
that is accept a cluster from the caller; another is to create
and shut down your won cluster if a global option is set (via options()
or a mechanism of your own).

If you create and shut down your own cluster you can do pretty much
what you like. If you use one passed to you it would be best to leave
it in the state you found it at least as far as the search path and
global environment are concerned. So use foo::bar instead of library().

User can also set a default cluster. You can use getDefaultCluster to
retrieve it; this returns NULL if no default cluster is set.  You
could assume that if one is set you are allowed to use it, but it
might still be a good idea to look for explicit permission via an
option or an argument. I would again try to leave the cluster used
this way in as clean a state as you can.

Best,

luke
On Sun, 24 May 2020, Ivan Krylov wrote: