-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from getwilds/dev
new fxn cromwell_labels
- Loading branch information
Showing
14 changed files
with
156 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#' Cromwell labels for a workflow | ||
#' | ||
#' @export | ||
#' @template workflowid | ||
#' @template serverdeets | ||
#' @return a named list of workflow labels | ||
cromwell_labels <- function(workflow_id, url = cw_url(), token = NULL) { | ||
check_url(url) | ||
response <- http_get( | ||
url = make_url( | ||
url, | ||
"api/workflows/v1", | ||
workflow_id, | ||
"labels" | ||
), | ||
as = "parsed", | ||
token = token | ||
) | ||
labels <- response$labels | ||
names(labels)[grep("cromwell-workflow-id", names(labels))] <- "workflow_id" | ||
labels | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
http_interactions: | ||
- request: | ||
method: get | ||
uri: http://localhost:8000/api/workflows/v1/287c7902-abc0-49ab-a6ec-0ce0c097b4d2/labels | ||
body: | ||
encoding: '' | ||
string: '' | ||
headers: | ||
Accept: application/json, text/xml, application/xml, */* | ||
response: | ||
status: | ||
status_code: 200 | ||
category: Success | ||
reason: OK | ||
message: 'Success: (200) OK' | ||
headers: | ||
server: akka-http/10.1.15 | ||
date: Fri, 26 Jul 2024 19:26:12 GMT | ||
content-type: application/json | ||
content-length: '200' | ||
body: | ||
encoding: '' | ||
file: no | ||
string: '{"id":"287c7902-abc0-49ab-a6ec-0ce0c097b4d2","labels":{"Label":"Apple","secondaryLabel":"Orange","workflowType":"AppSubmission","cromwell-workflow-id":"cromwell-287c7902-abc0-49ab-a6ec-0ce0c097b4d2"}}' | ||
recorded_at: 2024-07-26 19:26:12 GMT | ||
recorded_with: vcr/1.6.0, webmockr/1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
http_interactions: | ||
- request: | ||
method: post | ||
uri: http://localhost:8000/api/workflows/v1 | ||
body: | ||
encoding: '' | ||
string: workflowSource=list(path = "/Users/schambe3/github/getwilds/rcromwell/inst/examples/hello.wdl", | ||
type = "application/octet-stream", name = NULL),workflowInputs=list(path = | ||
"/Users/schambe3/github/getwilds/rcromwell/inst/examples/inputs.json", type | ||
= "application/json", name = NULL),labels=list(path = "/private/var/folders/qt/fzq1m_bj2yb_7b2jz57s9q7c0000gp/T/Rtmp21huqY/rcromwell_1609933b0cbaf.json", | ||
type = "application/json", name = NULL) | ||
headers: | ||
Accept: application/json, text/xml, application/xml, */* | ||
response: | ||
status: | ||
status_code: 201 | ||
category: Success | ||
reason: Created | ||
message: 'Success: (201) Created' | ||
headers: | ||
server: akka-http/10.1.15 | ||
date: Fri, 26 Jul 2024 19:25:52 GMT | ||
content-type: application/json | ||
content-length: '66' | ||
body: | ||
encoding: '' | ||
file: no | ||
string: '{"id":"287c7902-abc0-49ab-a6ec-0ce0c097b4d2","status":"Submitted"}' | ||
recorded_at: 2024-07-26 19:25:52 GMT | ||
recorded_with: vcr/1.6.0, webmockr/1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
test_that("cromwell_labels", { | ||
my_labels <- data.frame( | ||
"workflowType" = "AppSubmission", | ||
"Label" = "Apple", | ||
"secondaryLabel" = "Orange" | ||
) | ||
|
||
vcr::use_cassette("cromwell_labels_submit", { | ||
res <- cromwell_submit_batch( | ||
wdl = file_hello, params = file_inputs, | ||
labels = my_labels | ||
) | ||
}) | ||
|
||
# Sys.sleep(20) # Needed only for recording new fixture #nolint | ||
|
||
vcr::use_cassette("cromwell_labels_data", { | ||
labels_from_workflow <- cromwell_labels(res$id) | ||
}) | ||
|
||
expect_length(labels_from_workflow, 4) | ||
expect_equal(labels_from_workflow$Label, "Apple") | ||
expect_equal(labels_from_workflow$secondaryLabel, "Orange") | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters