Skip to content

Commit

Permalink
save ingest report to file and output
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Sep 20, 2023
1 parent 9b58dc4 commit dd0f66c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions chord_metadata_service/chord/workflows/wdls/experiments_json.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ workflow experiments_json {
json_document = json_document,
katsu_url = katsu_url,
dataset_id = dataset_id,
token = secret__access_token
token = secret__access_token,
ingest_report = "~{run_dir}/ingest_report.json"
}

output {
File stdout = ingest_task.txt_output
File stderr = ingest_task.err_output
File ingest_report = ingest_task.ingest_report
}
}

Expand All @@ -30,14 +32,17 @@ task ingest_task {
String katsu_url
String dataset_id
String token
String ingest_report
}
command <<<
RESPONSE=$(curl -X POST -k -s -w "%{http_code}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ~{token}" \
--data "@~{json_document}" \
"~{katsu_url}/ingest/~{dataset_id}/experiments_json")
if [[ "${RESPONSE}" != "201" ]]
-o "~{ingest_report}" \
"~{katsu_url}/ingest/~{dataset_id}/experiments_json" | jq)

if [[ "${RESPONSE}" != true ]]
then
echo "Error: Metadata service replied with ${RESPONSE}" 1>&2 # to stderr
exit 1
Expand All @@ -48,5 +53,6 @@ task ingest_task {
output {
File txt_output = stdout()
File err_output = stderr()
File ingest_report = "~{ingest_report}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ workflow phenopackets_json {
json_document = json_document,
katsu_url = katsu_url,
dataset_id = dataset_id,
token = secret__access_token
token = secret__access_token,
ingest_report = "~{run_dir}/ingest_report.json"
}

output {
File stdout = ingest_task.txt_output
File stderr = ingest_task.err_output
File stderr = ingest_task.err_output
}
}

Expand All @@ -30,13 +32,16 @@ task ingest_task {
String katsu_url
String dataset_id
String token
String ingest_report
}
command <<<
RESPONSE=$(curl -X POST -k -s -w "%{http_code}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ~{token}" \
--data "@~{json_document}" \
-o "~{ingest_report}" \
"~{katsu_url}/ingest/~{dataset_id}/phenopackets_json")

if [[ "${RESPONSE}" != "201" ]]
then
echo "Error: Metadata service replied with ${RESPONSE}" 1>&2 # to stderr
Expand All @@ -48,5 +53,6 @@ task ingest_task {
output {
File txt_output = stdout()
File err_output = stderr()
File ingest_report = "~{ingest_report}"
}
}

0 comments on commit dd0f66c

Please sign in to comment.