Skip to content

Commit

Permalink
status()
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 8, 2023
1 parent 11ff93b commit 8c1ff00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions R/crew_aws_batch_monitor.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 20 additions & 12 deletions tests/monitor/jobs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 8c1ff00

Please sign in to comment.