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

API: Specifying required and preferred resources / tags #2

Open
HenrikBengtsson opened this issue Aug 26, 2017 · 10 comments
Open

API: Specifying required and preferred resources / tags #2

HenrikBengtsson opened this issue Aug 26, 2017 · 10 comments

Comments

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Aug 26, 2017

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
Copy link
Collaborator Author

HenrikBengtsson commented Jan 9, 2021

Grammar of Resources

Examples

resources = ~ rng & { localhost | (file("./.Rprofile"):wr:optional & folder(".future"):wr) & globals(a , b) })
  • localhost
  • !fork
  • rng
  • r >= 4.0
  • capabilities: ...
  • env:CLUSTER %in% c("Berkeley", "UCSF")
  • `option:golbat=42
  • package:matrixStats >= 53.0
  • file:"/data/input.rds"
  • dir:"/data":w
  • time:00:05:00 # HPC compatible
  • mem:"8GB" # HPC compatible
  • mem:8*GB
  • mem:8:GB
  • os:windows
  • global: d49b58bb32c13e383665e52df5e0d8e0
  • cache: d49b58bb32c13e383665e52df5e0d8e0
  • tag:my_data, tag:gpu
  • worker:(x >= 42) # this will be evaluated on targeted worker and must return TRUE in order for worker to be used

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

  • localhost: we need a way to query the current backend on this. If not TRUE, we will fall back to sequential
  • !fork: query backend if it used forked processing. If not answering FALSE, then use sequential

@HenrikBengtsson
Copy link
Collaborator Author

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

@HenrikBengtsson
Copy link
Collaborator Author

HenrikBengtsson commented Jan 10, 2021

Dynamic specifications:

  • file:{{ pathname }}
  • memory:{{ size }}*GB

@HenrikBengtsson
Copy link
Collaborator Author

  • Need a way to query backends whether or not they support the requested resources

@HenrikBengtsson
Copy link
Collaborator Author

HenrikBengtsson commented Jan 11, 2021

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

@HenrikBengtsson
Copy link
Collaborator Author

HenrikBengtsson commented Jan 16, 2021

  • Verify that R CMD check doesn't complain about resource terms being missing globals

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
Copy link
Collaborator Author

HenrikBengtsson commented Jan 16, 2021

  • Need to rename argument resources for future.batchtools.

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
Copy link
Collaborator Author

HenrikBengtsson commented Jan 25, 2021

<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
Copy link
Collaborator Author

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

@HenrikBengtsson
Copy link
Collaborator Author

plan(multisession, provides = ~ tag:my_data, token:gpu:5)

@HenrikBengtsson HenrikBengtsson transferred this issue from another repository May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant