Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent workers for future_lapply parallelism #374

Merged
merged 19 commits into from
May 4, 2018
Merged

Conversation

wlandau
Copy link
Member

@wlandau wlandau commented May 4, 2018

Summary

I did it! make(parallelism = "future_lapply", jobs = n) launches n persistent workers that walk the dependency graph and build targets! Here, the master process is a special callr::r_bg() process.

Another fix: workers have to clock in with mc_set_ready() before the master process assigns them targets. That way, drake will not hang if there are multiple "workers" but fewer processes that actually launch. For example, future_lapply() does not actually launch new processes for future::plan(sequential)

library(drake)
library(future)
future::plan(sequential)
load_mtcars_example()
make(my_plan, parallelism = "future_lapply", jobs = 8)

To launch the 8 jobs promised above, use future::plan(multicore) or any of the other non-serial backends.

GitHub issues fixed

Checklist

  • I have read drake's code of conduct, and I agree to follow its rules.
  • I have read the guidelines for contributing.
  • I have listed any substantial changes in the development news.
  • I have added testthat unit tests to tests/testthat to confirm that any new features or functionality work correctly.
  • I have tested this pull request locally with devtools::check()
  • This pull request is ready for review.
  • I think this pull request is ready to merge.

@codecov-io
Copy link

codecov-io commented May 4, 2018

Codecov Report

Merging #374 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #374   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          66     66           
  Lines        5485   5529   +44     
=====================================
+ Hits         5485   5529   +44
Impacted Files Coverage Δ
R/color.R 100% <ø> (ø) ⬆️
R/console.R 100% <100%> (ø) ⬆️
R/future_lapply.R 100% <100%> (ø) ⬆️
R/handlers.R 100% <100%> (ø) ⬆️
R/build.R 100% <100%> (ø) ⬆️
R/mclapply.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2cbbade...f396e32. Read the comment docs.

@wlandau wlandau merged commit 871e243 into master May 4, 2018
@wlandau wlandau deleted the i369-future_lapply branch May 4, 2018 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants