diff --git a/R/crew_aws_batch_monitor.R b/R/crew_aws_batch_monitor.R index 47392fd..cf12f9d 100644 --- a/R/crew_aws_batch_monitor.R +++ b/R/crew_aws_batch_monitor.R @@ -689,12 +689,12 @@ crew_class_aws_batch_monitor <- R6::R6Class( ) ) } - out <- result$jobs[[1L]] + out <- client$describe_jobs(jobs = id)$jobs[[1L]] tibble::tibble( name = out$jobName, id = out$jobId, arn = out$jobArn, - status = out$status, + status = tolower(out$status), reason = if_any( length(out$statusReason), out$statusReason, diff --git a/tests/monitor/jobs.R b/tests/monitor/jobs.R index 1381095..89d03f9 100644 --- a/tests/monitor/jobs.R +++ b/tests/monitor/jobs.R @@ -39,18 +39,26 @@ test_that("job list", { ) job <- x$submit() expect_equal(nrow(x$status(id = job$id)), 1L) - expect_true(tibble::is_tibble(x$jobs())) - expect_true(tibble::is_tibble(x$submitted())) - expect_true(tibble::is_tibble(x$active())) - expect_true(tibble::is_tibble(x$inactive())) - expect_true(tibble::is_tibble(x$pending())) - expect_true(tibble::is_tibble(x$runnable())) - expect_true(tibble::is_tibble(x$succeeded())) - expect_true(tibble::is_tibble(x$failed())) - expect_true(nrow(out) > 0L) - expect_true(job$name %in% out$name) - expect_true(job$id %in% out$id) - expect_true(job$arn %in% out$arn) + expect_true(tibble::is_tibble(jobs <- x$jobs())) + expect_true(tibble::is_tibble(submitted <- x$submitted())) + expect_true(tibble::is_tibble(active <- x$active())) + expect_true(tibble::is_tibble(inactive <- x$inactive())) + expect_true(tibble::is_tibble(pending <- x$pending())) + expect_true(tibble::is_tibble(runnable <- x$runnable())) + expect_true(tibble::is_tibble(running <- x$running())) + expect_true(tibble::is_tibble(succeeded <- x$succeeded())) + expect_true(tibble::is_tibble(failed <- x$failed())) + expect_true(nrow(jobs) > 0L) + exp <- nrow(submitted) + + nrow(pending) + + nrow(runnable) + + nrow(running) + + nrow(succeeded) + + nrow(failed) + expect_equal(nrow(jobs), exp) + expect_true(job$name %in% jobs$name) + expect_true(job$id %in% jobs$id) + expect_true(job$arn %in% jobs$arn) info <- x$status(id = job$id) expect_true(is.na(info$reason)) expect_false(info$status %in% c("succeeded", "failed"))