11#! /bin/bash
22#
3- # jobs-delete
3+ # jobs-hide
44#
55# author: opensource@tacc.cloud
66#
77# This script is part of the Agave API command line interface (CLI).
8- # It deletes a job. If running the job will be stopped .
9- #
8+ # It marks a job as invisible to most APIs like job listing or history calls .
9+ # This can only be done for jobs in a terminal state.
1010
1111DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
1212
@@ -22,7 +22,8 @@ interactive_opts=(apisecret apikey)
2222usage () {
2323 echo -n " $( basename $0 ) [OPTION]... [JOB_ID]
2424
25- Delete an existing job. If running, the job will be killed.
25+ Hide an existing job from most APIs, such as listing and history. If the job is
26+ still running, it cannot be hidden. It must be stopped first.
2627
2728 Options:
2829 -z, --access_token Access token
@@ -51,16 +52,16 @@ main() {
5152 # set -x
5253
5354 if [ -z " $args " ]; then
54- err " Please specify a valid app id to delete "
55+ err " Please specify a valid app id to hide "
5556 else
5657
57- cmd=" curl -sk -H \" ${authheader} \" -X DELETE '$hosturl$args ?pretty=true'"
58+ cmd=" curl -sk -H \" ${authheader} \" -H \" Content-Type: application/json \" -X POST '$hosturl ${ args} /hide ?pretty=true'"
5859
5960 if (( veryverbose)) ; then
6061 [ " $piped " -eq 0 ] && log " Calling $cmd "
6162 fi
6263
63- response=` curl -sk -H " ${authheader} " -X DELETE " $hosturl$args ?pretty=true" `
64+ response=` curl -sk -H " ${authheader} " -H " Content-Type: application/json " -X POST " $hosturl ${ args} /hide ?pretty=true" `
6465
6566 if [[ $( jsonquery " $response " " status" ) = ' success' ]]; then
6667 result=$( format_api_json " $response " )
@@ -80,7 +81,7 @@ format_api_json() {
8081 result=$( jsonquery " $1 " " result" 1)
8182 json_prettyify " ${result} "
8283 else
83- echo " Successfully deleted job $args "
84+ echo " Successfully hid job $args "
8485 fi
8586}
8687
0 commit comments