This repository has been archived by the owner on Mar 22, 2020. It is now read-only.
/
README.Rmd
60 lines (44 loc) · 2.17 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
output: github_document
---
[![stability-deprecated](https://img.shields.io/badge/stability-deprecated-red.svg)](https://github.com/emersion/stability-badges#deprecated)
[![Travis build status](https://travis-ci.org/wlandau/drake.future.lapply.staged.svg?branch=master)](https://travis-ci.org/wlandau/drake.future.lapply.staged)
[![Test coverage](https://codecov.io/github/wlandau/drake.future.lapply.staged/coverage.svg?branch=master)](https://codecov.io/github/wlandau/drake.future.lapply.staged?branch=master)
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(drake.future.lapply.staged)
```
# Staged parallelism for the drake R package
With staged parallelism, `drake` partitions the dependency graph into stages of conditionally independent targets and processes each stage with semi-transient parallel workers. This functionality is already deprecated, and it will be removed at some point later on.
## Installation
```{r installstaged, eval = FALSE}
library(remotes)
install_github("ropensci/drake")
install_github("wlandau/drake.future.lapply.staged")
```
## Usage
We begin with a `drake` project.
```{r beginstaged}
library(drake.future.lapply.staged)
plan <- drake_plan(x = rnorm(100), y = mean(x), z = median(x))
plan
```
First, create a `future` plan. See the [`future` README](https://github.com/HenrikBengtsson/future/blob/master/README.md) and [`future.batchtools` README](https://github.com/HenrikBengtsson/future.batchtools/blob/master/README.md) for guidance, and consult tables [here](https://github.com/HenrikBengtsson/future/blob/master/README.md#controlling-how-futures-are-resolved) and [here](https://github.com/HenrikBengtsson/future.batchtools/blob/master/README.md#choosing-batchtools-backend) for options for your plan.
```{r introstaged}
library(future)
plan(multiprocess)
```
Next, run your `drake` project.
```{r rundrake}
library(drake.future.lapply.staged)
make(plan, parallelism = backend_future_lapply_staged, jobs = 2)
```
```{r cleanup, echo = FALSE}
unlink(".drake", recursive = TRUE)
```