Skip to content

Commit 373d04c

Browse files
authored
Merge pull request #17 from vimc/vimc-4637
2 parents 65752e7 + 8194c3b commit 373d04c

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: orderlyweb
22
Title: Orderly Support for 'OrderlyWeb'
3-
Version: 0.1.11
3+
Version: 0.1.12
44
Authors@R:
55
c(person(given = "Rich",
66
family = "FitzJohn",

R/orderly.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,9 @@ R6_orderlyweb_remote <- R6::R6Class(
7272

7373
bundle_import = function(path, progress = TRUE) {
7474
private$client$bundle_import(path, progress)
75+
},
76+
77+
queue_status = function() {
78+
private$client$queue_status()
7579
}
7680
))

R/orderlyweb.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ R6_orderlyweb <- R6::R6Class(
248248

249249
git_fetch = function(client = NULL) {
250250
self$api_client$POST("/reports/git/fetch/")
251+
},
252+
253+
queue_status = function() {
254+
self$api_client$GET("/queue/status/")
251255
}
252256
))
253257

tests/testthat/test-integration.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,16 @@ test_that("can pass instance to bundle pack", {
420420
readRDS(file.path(tmp, dir(tmp), "meta", "info.rds"))$instance,
421421
"default")
422422
})
423+
424+
425+
test_that("queue status", {
426+
cl <- test_orderlyweb()
427+
run <- cl$report_run("slow3", open = FALSE, progress = FALSE, wait = FALSE)
428+
Sys.sleep(2) ## Ensure report gets started
429+
res <- cl$queue_status()
430+
expect_length(res$tasks, 1)
431+
expect_equal(res$tasks[[1]]$name, "slow3")
432+
expect_true(!is.null(res$tasks[[1]]$version))
433+
expect_equal(res$tasks[[1]]$key, run$key)
434+
expect_equal(res$tasks[[1]]$status, "running")
435+
})

tests/testthat/test-orderly.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,19 @@ test_that("bundle high level interface", {
171171

172172
expect_true(ans$id %in% remote$list_versions("minimal"))
173173
})
174+
175+
176+
test_that("queue status", {
177+
skip_if_no_orderlyweb_server()
178+
token <- Sys.getenv("ORDERLYWEB_TEST_TOKEN")
179+
remote <- orderlyweb_remote(host = "localhost", port = 8888,
180+
token = token, https = FALSE)
181+
out <- remote$run("slow3", open = FALSE, progress = FALSE, wait = FALSE)
182+
Sys.sleep(2) ## Ensure report gets started
183+
res <- remote$queue_status()
184+
expect_length(res$tasks, 1)
185+
expect_equal(res$tasks[[1]]$name, "slow3")
186+
expect_true(!is.null(res$tasks[[1]]$version))
187+
expect_equal(res$tasks[[1]]$key, out$key)
188+
expect_equal(res$tasks[[1]]$status, "running")
189+
})

0 commit comments

Comments
 (0)