Skip to contents

Query a driver to find information about the cluster, and then validate a hipercow_resources list against that driver to see if the resources requested could be satisfied.

Usage

hipercow_resources_validate(resources, driver = NULL, root = NULL)

Arguments

resources

A hipercow_resources list returned by hipercow_resources, or NULL

driver

The name of the driver to use, or you can leave blank if only one is configured (this will be typical).

root

The hipercow root

Value

TRUE if the resources are compatible with this driver.

Examples

cleanup <- hipercow_example_helper()
#>  This example uses a special helper
hipercow_resources_validate(hipercow_resources(cores = 1))
#> 
#> ── hipercow resource control (hipercow_resources) ──────────────────────────────
#> • cores: 1
#> • exclusive: FALSE
#> • queue: alltasks
#> Unset: 'max_runtime', 'hold_until', 'memory_per_node', 'memory_per_process',
#> 'requested_nodes', and 'priority'

# This example does not allow more than one core
tryCatch(
  hipercow_resources_validate(hipercow_resources(cores = 32)),
  error = identity)
#> <error/rlang_error>
#> Error in `validate_cluster_cores()`:
#> ! 32 is too many cores for this cluster.
#>  The largest node has 4 cores.
#> ---
#> Backtrace:
#>      
#>   1. └─pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
#>   2.   └─pkgdown::build_site(...)
#>   3.     └─pkgdown:::build_site_local(...)
#>   4.       └─pkgdown::build_reference(...)
#>   5. ─pkgdown:::unwrap_purrr_error(...)
#>   6. └─base::withCallingHandlers(...)
#>   7.         └─purrr::map(...)
#>   8.           └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
#>   9. ─purrr:::with_indexed_errors(...)
#>  10. └─base::withCallingHandlers(...)
#>  11. purrr:::call_with_cleanup(...)
#>  12.             └─pkgdown (local) .f(.x[[i]], ...)
#>  13. base::withCallingHandlers(...)
#>  14.               └─pkgdown:::data_reference_topic(...)
#>  15.                 └─pkgdown:::run_examples(...)
#>  16.                   └─pkgdown:::highlight_examples(code, topic, env = env)
#>  17.                     └─downlit::evaluate_and_highlight(...)
#>  18.                       └─evaluate::evaluate(code, child_env(env), new_device = TRUE, output_handler = output_handler)
#>  19.                         └─evaluate:::evaluate_call(...)
#>  20. ─evaluate (local) timing_fn(...)
#>  21. ─evaluate (local) handle(...)
#>  22. └─base::try(f, silent = TRUE)
#>  23. └─base::tryCatch(...)
#>  24. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>  25. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>  26. └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>  27. ─base::withCallingHandlers(...)
#>  28. ─base::withVisible(...)
#>  29.                           └─evaluate:::eval_with_user_handlers(expr, envir, enclos, user_handlers)
#>  30.                             └─base::eval(expr, envir, enclos)
#>  31.                               └─base::eval(expr, envir, enclos)
#>  32. ─base::tryCatch(...)
#>  33. └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>  34. └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>  35. └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>  36.                                 └─hipercow::hipercow_resources_validate(hipercow_resources(cores = 32))
#>  37.                                   └─hipercow:::resources_validate(resources, driver, root)
#>  38.                                     └─hipercow:::validate_cluster_cores(resources$cores, cluster_resources$max_cores)

cleanup()
#>  Cleaning up example