You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just seeing if there is a sure fire way to determine if you are already within a foreach loop using %dopar%? As it is currently, I have a workaround function that parses sys.status() for any foreach calls that also use %dopar%-
I strongly recommend treating %dopar% as a different feature than %do%. They're very different and should not be though of as they can substitute each other. To run sequentially with %dopar%, always use registerDoSEQ(). Do not switch code to use %do%.
Unfortunately, I don't think there's a public interface to query which %dopar% adaptor is registered. [removed code snippet]. See my comment below.
Finally, (disclaimer: I'm the maintainer), if you use doFuture::registerDoFuture(), then %dopar% will process via the future framework. cf. https://doFuture.futureverse.org/. There, you control what sequential or parallel backend to use via future::plan() and that one you can query for things such number of parallel workers. Note also, that the future framework automatically protects against exploding, nested parallelization, if that's what you're after, cf. https://future.futureverse.org/#nested-futures-and-evaluation-topologies.
Just seeing if there is a sure fire way to determine if you are already within a foreach loop using
%dopar%
? As it is currently, I have a workaround function that parsessys.status()
for any foreach calls that also use%dopar%
-However, this feels pretty limited and doesn't cover the case in which someone uses a variable to hold
%dopar%
like below-The text was updated successfully, but these errors were encountered: