Skip to contents

Run a task that has been created by a task_create_* function, e.g., task_create_explicit(), task_create_expr(). Generally users should not run this function directly.

Usage

task_eval(id, envir = .GlobalEnv, verbose = FALSE, root = NULL)

Arguments

id

The task identifier

envir

An environment in which to evaluate the expression. For non-testing purposes, generally ignore this, the global environment will be likely the expected environment.

verbose

Logical, indicating if we should print information about what we do as we do it.

root

A hipercow root, or path to it. If NULL we search up your directory tree.

Value

Logical indicating success (TRUE) or failure (FALSE)

Examples

cleanup <- hipercow_example_helper(runner = FALSE)
#>  This example uses a special helper
id <- task_create_expr(runif(1), driver = FALSE)
# Status is only 'created', not 'submitted', as we did not submit
# task.  This task can never run.
task_status(id)
#> [1] "created"

# Explicitly evaluate the task:
task_eval(id, verbose = TRUE)
#> 
#> ── hipercow 1.0.36 running at '/tmp/Rtmpw3JKrD/file16dc4739deb1' ───────────────
#>  library paths:
#>   • /home/runner/work/_temp/Library
#>   • /opt/R/4.4.1/lib/R/site-library
#>   • /opt/R/4.4.1/lib/R/library
#>  id: f9a49f3d88c73f013a61953d14bf80d1
#>  starting at: 2024-10-08 15:27:13.989743
#>  Task type: expression
#>   • Expression: runif(1)
#>   • Locals: (none)
#>   • Environment: default
#>     R_GC_MEM_GROW: 3
#> ───────────────────────────────────────────────────────────────── task logs ↓ ──
#> 
#> ───────────────────────────────────────────────────────────────── task logs ↑ ──
#>  status: success
#>  finishing at: 2024-10-08 15:27:13.989743 (elapsed: 0.06753 secs)
task_result(id)
#> [1] 0.5144025

cleanup()
#>  Cleaning up example