tests/testthat/test-crew_controller_pbs.R

test_that("crew_controller_pbs() script() all lines", {
  x <- crew_controller_pbs(
    options_cluster = crew_options_pbs(
      script_lines = c("module load R", "echo 'start'"),
      cwd = TRUE,
      log_output = "out_dir/",
      log_error = "err_dir/",
      log_join = FALSE,
      memory_gigabytes_required = 2,
      cores = 2L,
      walltime_hours = 57
    )
  )
  out <- x$launcher$script(name = "this_job")
  exp <- c(
    "#PBS -N this_job",
    "#PBS -o out_dir/",
    "#PBS -e err_dir/",
    "#PBS -j n",
    "#PBS -l mem=2gb",
    "#PBS -l ppn=2",
    "#PBS -l walltime=57:00:00",
    "module load R",
    "echo 'start'",
    "cd \"$PBS_O_WORKDIR\""
  )
  expect_equal(out, exp)
})

# https://github.com/wlandau/crew/issues/217
test_that("crew_controller_pbs() cleanup deprecations", {
  x <- crew_controller_pbs()
  fields <- c(
    "reset_globals",
    "reset_packages",
    "reset_globals",
    "garbage_collection"
  )
  for (field in fields) {
    expect_true(is.logical(x[[field]]))
    expect_null(x$launcher[[field]])
  }
})

Try the crew.cluster package in your browser

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

crew.cluster documentation built on June 9, 2025, 5:08 p.m.