From 47a2547070acb1aae1e2e300082397aa19d71bea Mon Sep 17 00:00:00 2001 From: wlandau-lilly Date: Thu, 7 Dec 2023 15:49:37 -0500 Subject: [PATCH] Checks --- R/crew_aws_batch_monitor.R | 10 ++-- inst/WORDLIST | 5 +- man/crew_class_aws_batch_monitor.Rd | 6 +- tests/testthat/test-crew_aws_batch_monitor.R | 61 ++++++++++++++++++++ 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/R/crew_aws_batch_monitor.R b/R/crew_aws_batch_monitor.R index e5c8b69..be4e94b 100644 --- a/R/crew_aws_batch_monitor.R +++ b/R/crew_aws_batch_monitor.R @@ -160,7 +160,7 @@ crew_class_aws_batch_monitor <- R6::R6Class( memory <- memory * ((5L ^ 9L) / (2L ^ 11L)) } args <- list() - args$jobDefinitionName = private$.job_definition + args$jobDefinitionName <- private$.job_definition args$type <- "container" args$schedulingPriority <- scheduling_priority args$propagateTags <- propagate_tags @@ -304,7 +304,7 @@ crew_class_aws_batch_monitor <- R6::R6Class( #' revision number of the registered job definition. #' @param image Character of length 1, Docker image used for each job. #' You can supply a path to an image in Docker Hub or the full URI - #' of an image in an Amazohn ECR repository. + #' of an image in an Amazon ECR repository. #' @param memory_units Character of length 1, #' either `"gigabytes"` or `"mebibytes"` to set the units of the #' `memory` argument. `"gigabytes"` is simpler for EC2 jobs, but @@ -372,8 +372,8 @@ crew_class_aws_batch_monitor <- R6::R6Class( ) # nocov end }, - #' @description Attempt to deeregister the job definition. - #' @details Attempt to dereregister the job definition whose name was + #' @description Attempt to deregister the job definition. + #' @details Attempt to deregister the job definition whose name was #' originally supplied to the `job_definition` argument of #' [crew_aws_batch_monitor()]. #' @return `NULL` (invisibly). @@ -395,7 +395,7 @@ crew_class_aws_batch_monitor <- R6::R6Class( #' @return If the job definition is not active or does not exist, #' `describe()` returns `NULL`. Otherwise, it returns #' a `tibble` with job definition information. Some fields - #' may be nested lists. + #' may be nested lists. describe = function() { # Covered in tests/interactive/job_definitions.R # nocov start diff --git a/inst/WORDLIST b/inst/WORDLIST index c7467c8..d905f64 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -124,4 +124,7 @@ www ’ ARN deregister - +mebibytes +MiB +nolint +URI diff --git a/man/crew_class_aws_batch_monitor.Rd b/man/crew_class_aws_batch_monitor.Rd index 9ba1f6b..b7e0117 100644 --- a/man/crew_class_aws_batch_monitor.Rd +++ b/man/crew_class_aws_batch_monitor.Rd @@ -123,7 +123,7 @@ Register a job definition. \describe{ \item{\code{image}}{Character of length 1, Docker image used for each job. You can supply a path to an image in Docker Hub or the full URI -of an image in an Amazohn ECR repository.} +of an image in an Amazon ECR repository.} \item{\code{platform_capabilities}}{Optional character of length 1, either \code{"EC2"} to run on EC2 or \code{"FARGATE"} to run on Fargate.} @@ -188,13 +188,13 @@ revision number of the registered job definition. \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-crew_class_aws_batch_monitor-deregister}{}}} \subsection{Method \code{deregister()}}{ -Attempt to deeregister the job definition. +Attempt to deregister the job definition. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{crew_class_aws_batch_monitor$deregister()}\if{html}{\out{
}} } \subsection{Details}{ -Attempt to dereregister the job definition whose name was +Attempt to deregister the job definition whose name was originally supplied to the \code{job_definition} argument of \code{\link[=crew_aws_batch_monitor]{crew_aws_batch_monitor()}}. } diff --git a/tests/testthat/test-crew_aws_batch_monitor.R b/tests/testthat/test-crew_aws_batch_monitor.R index 549aae6..8c4cb3f 100644 --- a/tests/testthat/test-crew_aws_batch_monitor.R +++ b/tests/testthat/test-crew_aws_batch_monitor.R @@ -17,3 +17,64 @@ test_that("crew_aws_batch_monitor()", { expect_equal(out$endpoint, "endpoint_url") expect_equal(out$region, "us-east-2") }) + +test_that("crew_aws_batch_monitor() private$.register_args()", { + skip_on_cran() + x <- crew_aws_batch_monitor( + job_definition = "job-definition-name", + job_queue = "crew-aws-batch-job-queue", + region = "us-east-2" + ) + out <- x$.__enclos_env__$private$.register_args( + image = "alpine:latest", + platform_capabilities = "EC2", + memory_units = "gigabytes", + memory = 1, + cpus = 1, + gpus = 1, + seconds_timeout = 600, + scheduling_priority = 3, + tags = c("crew_aws_batch_1", "crew_aws_batch_2"), + propagate_tags = TRUE, + job_role_arn = "job_role_arn_id", + execution_role_arn = "execution_role_arn_id" + ) + exp <- list( + jobDefinitionName = "job-definition-name", + type = "container", + schedulingPriority = 3, + propagateTags = TRUE, + platformCapabilities = "EC2", + timeout = list(attemptDurationSeconds = 600), + containerProperties = list( + image = "alpine:latest", + resourceRequirements = list( + memory = list(value = "954", type = "MEMORY"), + cpus = list( + value = "1", + type = "VCPU" + ), + gpus = list( + value = "1", + type = "GPU" + ) + ), + logConfiguration = list( + logDriver = "awslogs", + options = list( + "awslogs-group" = "/aws/batch/job", + "awslogs-region" = "us-east-2", + "awslogs-stream-prefix" = "job-definition-name" + ) + ) + ) + ) + expect_equal(out, exp) +}) + +test_that("crew_aws_batch_monitor() private$.client()", { + skip_on_cran() + x <- crew_aws_batch_monitor(job_queue = "x") + out <- x$.__enclos_env__$private$.client() + expect_true(is.function(out$list_jobs)) +})