rr-future

Check if multisession is running in future R


Is there a quick way to check if multiple processes were generated by future package on the current R?

In other words, to check whether plan(multisession) or similar was run in R?


Solution

  • As it is said in the comments, you can check (in the main process) the class of the object (a function) returned by plan() with no arguments.

    library(future)
    
    is(plan(), "multisession")   # TRUE if plan(multisession) is set FALSE otherwise
    is(plan(), "sequential")     # ...
    ...