Skip to content
Dependent Delayed Computation
R Makefile TeX
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
docs
inst
man
tests
vignettes
.Rbuildignore
.gitignore
.travis.yml
CONTRIBUTING.md
DESCRIPTION
LICENSE
Makefile
NAMESPACE
README.Rmd
README.html
README.md
_pkgdown.yml
appveyor.yml
codecov.yml
cran-comments.md
delayed.Rproj

README.md

R/delayed

Travis-CI Build Status Build status Coverage Status Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. License: GPL v3

A framework for parallelizing dependent tasks

Author: Jeremy Coyle


What’s delayed?

delayed is an R package that provides a framework for parallelizing dependent tasks in an efficient manner. It brings to R a subset of the functionality implemented in Python’s Dask library. For details on how best to use delayed, please consult the package documentation and vignette online, or do so from within R.


Installation

Install the most recent stable release from GitHub via devtools:

devtools::install_github("tlverse/delayed")

Issues

If you encounter any bugs or have any specific feature requests, please file an issue.


Example

This minimal example shows how to use delayed to handle dependent computations via chaining of tasks:

library(delayed)
#> delayed: Framework for Parallelizing Dependent Tasks
#> Version: 0.3.0

# delay a function that does a bit of math
mapfun <- function(x, y) {(x + y) / (x - y)}
delayed_mapfun <- delayed_fun(mapfun)

set.seed(14765)
library(future)
plan(multicore, workers = 2)
const <- 7

# re-define the delayed object from above
delayed_norm <- delayed(rnorm(n = const))
delayed_pois <- delayed(rpois(n = const, lambda = const))
chained_norm_pois <- delayed_mapfun(delayed_norm, delayed_pois)

# compute it using the future plan (multicore with 2 cores)
chained_norm_pois$compute(nworkers = 2, verbose = TRUE)
#> run:0 ready:2 workers:2
#> updating rpois(n = const, lambda = const) from ready to running
#> run:1 ready:1 workers:2
#> updating rnorm(n = const) from ready to running
#> run:2 ready:0 workers:2
#> updating rnorm(n = const) from running to resolved
#> updating rpois(n = const, lambda = const) from running to resolved
#> updating mapfun(x = delayed_norm, y = delayed_pois) from waiting to ready
#> run:0 ready:1 workers:2
#> updating mapfun(x = delayed_norm, y = delayed_pois) from ready to running
#> run:1 ready:0 workers:2
#> updating mapfun(x = delayed_norm, y = delayed_pois) from running to resolved
#> [1] -0.6697397 -1.0751496 -1.2606063 -1.1100267 -1.0906962 -1.1846166
#> [7] -0.8610878

Remark: In the above, the delayed computation is carried out in parallel using the framework offered by the excellent future package and its associated ecosystem.


License

© 2017-2019 Jeremy R. Coyle

The contents of this repository are distributed under the GPL-3 license. See file LICENSE for details.

You can’t perform that action at this time.