-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace callback with workflow-monitor
- Loading branch information
Showing
3 changed files
with
17 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,14 @@ | ||
|
||
# set up reporting job status to INTERVENE backend | ||
|
||
# need to escape starting curly bracket to prevent templating error | ||
# (the comment above only makes sense in the original template file) | ||
callback_exit_handler() \{ | ||
# report the status of the job to the INTERVENE backend | ||
exit_code=$? | ||
|
||
if [ $exit_code -eq 0 ]; then | ||
body='\{"status": "COMPLETED", "pipelineId": "{name}", "outdir": ""}' | ||
else | ||
body='\{"status": "FAILED", "pipelineId": "{name}", "outdir": ""}' | ||
fi | ||
|
||
# do a callback | ||
url="https://dev.intervenegeneticscores.org/pipeline-manager/pipeline/csc/notify" | ||
# escaping json is a pain | ||
echo $body > callback.txt | ||
|
||
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic $CALLBACK_TOKEN" --data @callback.txt $url | ||
|
||
exit $exit_code | ||
} | ||
|
||
# run everything in "strict mode". error early, error often! | ||
set -euxo pipefail | ||
|
||
trap callback_exit_handler EXIT | ||
# set up reporting job status to INTERVENE backend | ||
|
||
# dependencies for workflow-monitor (python3.10 & requests library) | ||
module load python-data/3.10-23.07 | ||
|
||
# run the monitor in the background | ||
python3 {workflow_monitor_path} & | ||
|
||
# ------------------------------------------------------------------------------ | ||
|
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