Closed Zhuk66 closed 8 months ago
The issue here seems to be that while f
is exported, the associated S3 handlers are not.
Minimal way to reproduce this:
f <- function(i) {
UseMethod('f')
}
f.numeric <- function(i) {
sqrt(i)
}
clustermq::Q(f, i=1, n_jobs=1)
A workaround for this is to export the S3 handler explicitly:
clustermq::Q(f, i=1, n_jobs=1, export=list(f.numeric=f.numeric))
This, however, should work without user intervention.
We'll likely move from foreach::getexports
to globals::globalsOf
to better identify variables required to be exported for foreach
runs.
That said, neiter option currently identifies the S3 handler to be required. But that is an issue that should be fixed in these packages.
I'm closing this as upstream responsibility (see linked issue).
The following code does not work with clustermq. It worked with R 3.5.3 and it works in sequential mode. It also works with doParallel but not with clustermq. I tested with multisession and SLURM backends. Both gave me an error: