HenrikBengtsson / resources

R package: resources - Resource Specifications for R Evaluations
https://github.com/HenrikBengtsson/resources
Other
0 stars 0 forks source link

API: Specifying required and preferred resources / tags #2

Open HenrikBengtsson opened 7 years ago

HenrikBengtsson commented 7 years ago

Add mechanism for specifying required and preferred resources / tags, e.g.

f <- future(..., needs = c("path:/shared/data"), prefers = c("tag:himem"))

See also

HenrikBengtsson commented 3 years ago

Grammar of Resources

Examples

resources = ~ rng & { localhost | (file("./.Rprofile"):wr:optional & folder(".future"):wr) & globals(a , b) })

If the requirements cannot be met, a FutureError will be produced by future().

HenrikBengtsson commented 3 years ago

Resources can be (i) required, or (ii) optional. Among optional/preferred ones, we might have different preferences, but that might be overkill.

HenrikBengtsson commented 3 years ago

Dynamic specifications:

HenrikBengtsson commented 3 years ago
HenrikBengtsson commented 3 years ago

parallelly::isForkNode(node) parallelly::isLocalhostNode(node) isForkWorker() isForkPlan()

HenrikBengtsson commented 3 years ago

UPDATE: R CMD check will not give false positive globals when formulas are used, e.g.

hello <- function() {
  model <- y ~ x + 1
  message("Hello world!")
  invisible(model)
}
HenrikBengtsson commented 3 years ago

Edit 2021-01-23: can we incorporate the current list syntax into the new one, e.g.

resources = list(mem="5gb")

=>

resources = ~ batchtools:list(mem="5gb"):optional
resources = ~ batchtools:list(mem="5gb"):optional

This will allow us to use both styles

resources = ~ (file:"~/abc.csv" && r >= 4.0) + batchtools:list(mem="5gb"):optional
HenrikBengtsson commented 3 years ago
<resource>
<type>:<resource>
<resource>:<modifier>
<type>:<resource>:<modifier>

<type>: (host|memory|file|directory|package)
<resource>: (<expr>|<string>|<integer>|<numeric>)
<modifiers>: (required|preferred)

Examples:


<resource>:
localhost
fork

<type>:<resource>:
host:localhost
parallelization:fork
parallelization:(!fork)
parallelization:!fork
memory:2.5*GiB
file:"~/abc.csv"
file:("~/abc.csv":r)
file:("~/abc.csv":w)
file:("~/abc.csv":rw)
batchtools:list(mem="5gb")
package:xgboost
package:(xgboost >= 1.2)

<type>:<resource>:<modifier>:
file:"~/abc.csv":preferred
batchtools:list(mem="5gb"):preferred
HenrikBengtsson commented 3 years ago

A capability is single thing that both designates a resource and authorizes some kind of access to it. http://habitatchronicles.com/2017/05/

HenrikBengtsson commented 2 years ago
plan(multisession, provides = ~ tag:my_data, token:gpu:5)