tests/performance/test-exit.R

# Regression test for https://github.com/r-lib/callr/issues/185
library(targets)
tar_destroy()
tar_script({
  library(targets)
  list(
    tar_target(x, runif(1e7)),
    tar_target(y, stop(x[1]))
  )
})

# Should exit fast after y errors out:
tar_make(reporter = "timestamp")

tar_script({
  library(targets)
  tar_option_set(workspace_on_error = TRUE)
  list(
    tar_target(x, runif(1e7)),
    tar_target(y, stop(x[1]))
  )
})

# Should exit fast after y errors out:
tar_make(reporter = "timestamp")

tar_script({
  library(targets)
  tar_option_set(error = "continue")
  list(
    tar_target(x, runif(1e7)),
    tar_target(y, stop(x[1]))
  )
})

# Should run fast:
tar_make(reporter = "timestamp")

tar_destroy()
unlink("_targets.R")

Try the targets package in your browser

Any scripts or data that you put into this service are public.

targets documentation built on Oct. 12, 2023, 5:07 p.m.