Closed HenrikBengtsson closed 7 years ago
Ah... false alarm; info
is not a list but a function that foreach uses to query the resource each time. Nice. Proof that it works as expected:
> library("doFuture")
> registerDoFuture()
> nbrOfWorkers()
[1] 1
> getDoParWorkers()
[1] 1
> plan(multiprocess, workers = 2L)
> nbrOfWorkers()
[1] 2
> getDoParWorkers()
[1] 2
> library("future.BatchJobs")
> plan(batchjobs_local)
> nbrOfWorkers()
[1] 1
> getDoParWorkers()
[1] 1
> plan(batchjobs_torque)
> nbrOfWorkers()
[1] Inf
> getDoParWorkers()
[1] Inf
If changing number of future workers, then
registerDoFuture()
needs to be recalled in order to update foreach about it. This is whatregisterDoFuture()
does:That
setDoPar(..., info)
is what updates foreach.The question is, can we automate / hide this? For instance, can it be check when our foreach-adapter
doFuture()
is called? Or is that too late?