tests/testthat/test_killJobs.R

test_that("killJobs", {
  reg = makeTestRegistry()
  if (is.null(reg$cluster.functions$killJob))
    skip("Test requires killJobs")

  ids = batchMap(Sys.sleep, time = 60, reg = reg)
  silent(submitJobs(1, reg = reg))
  expect_equal(findOnSystem(1, reg = reg), findJobs(reg = reg))

  batch.id = reg$status[1, batch.id]
  silent({
    res = killJobs(1, reg = reg)
  })
  expect_equal(res$job.id, 1L)
  expect_equal(res$batch.id, batch.id)
  expect_true(res$killed)
})

Try the batchtools package in your browser

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

batchtools documentation built on April 20, 2023, 5:09 p.m.