tests/testthat/test-crew_options_aws_batch.R

test_that("basic options", {
  out <- crew_options_aws_batch(
    job_definition = "x",
    job_queue = "y"
  )
  expect_s3_class(out, c("crew_options_aws_batch", "crew_options"))
  expect_equal(out$job_definition, "x")
  expect_equal(out$job_queue, "y")
})

test_that("cpu and memory", {
  out <- crew_options_aws_batch(
    job_definition = "x",
    job_queue = "y",
    cpus = 0.5,
    memory = 2,
    memory_units = "gigabytes"
  )
  expect_s3_class(out, c("crew_options_aws_batch", "crew_options"))
  expect_equal(out$job_definition, "x")
  expect_equal(out$job_queue, "y")
  expect_equal(
    out$container_overrides,
    list(
      resourceRequirements = list(
        memory = list(value = "1907", type = "MEMORY"),
        cpus = list(value = "0.5", type = "VCPU")
      )
    )
  )
})

test_that("gpus", {
  out <- crew_options_aws_batch(
    job_definition = "x",
    job_queue = "y",
    gpus = 2
  )
  expect_s3_class(out, c("crew_options_aws_batch", "crew_options"))
  expect_equal(out$job_definition, "x")
  expect_equal(out$job_queue, "y")
  expect_equal(
    out$container_overrides,
    list(
      resourceRequirements = list(
        gpus = list(value = "2", type = "GPU")
      )
    )
  )
})

Try the crew.aws.batch package in your browser

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

crew.aws.batch documentation built on June 9, 2025, 5:09 p.m.