Skip to content

Commit aa3e47d

Browse files
lbergelsonjonn-smith
authored andcommitted
turtle status (#31)
* Now with logo. * adding status eye
1 parent cf0870f commit aa3e47d

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

cromshell

+63-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,48 @@ OPTIONS=''
5959

6060
################################################################################
6161

62+
function turtle()
63+
{
64+
if [[ -z $1 ]]; then
65+
eye="'"
66+
else
67+
eye=x
68+
fi
69+
echo " __ "
70+
echo " .,-;-;-,. /${eye}_\\ "
71+
echo " _/_/_/_|_\\_\\) / "
72+
echo " '-<_><_><_><_>=/\\ "
73+
echo " \`/_/====/_/-'\\_\\ "
74+
echo " \"\" \"\" \"\" "
75+
}
76+
77+
function thoughtBubble()
78+
{
79+
80+
echo " .-~~~-. "
81+
echo " .- ~ ~-( )_ _ "
82+
echo " / ~ -. "
83+
echo "| CROMSHELL \\ "
84+
echo " \\ .' "
85+
echo " ~- . _ _ . -~ "
86+
echo " ~~~~~~~~~~~"
87+
echo " () "
88+
echo " o "
89+
echo " ."
90+
}
91+
92+
function logo()
93+
{
94+
echo
95+
echo ' +--------------------------+'
96+
echo ' | CROMSHELL |'
97+
echo ' +--------------------------+'
98+
turtle
99+
echo
100+
}
101+
102+
################################################################################
103+
62104
function simpleUsage()
63105
{
64106
echo -e "Usage: ${SCRIPTNAME} <subcommand> [options]"
@@ -69,6 +111,7 @@ function simpleUsage()
69111
function usage()
70112
{
71113
simpleUsage
114+
echo -e
72115
echo -e "CROMWELL_URL=$CROMWELL_URL"
73116
echo
74117
echo -e "If no workflow-id is specified then the last submitted workflow-id is assumed."
@@ -218,7 +261,6 @@ trap at_exit EXIT
218261

219262
function populateWorkflowIdAndServerUrl()
220263
{
221-
222264
local userSpecifiedId=$1
223265

224266
# If the user specified a negative number, get the nth last workflow:
@@ -252,7 +294,8 @@ function populateWorkflowIdAndServerUrl()
252294
# Submit a workflow and arguments to the Cromwell Server
253295

254296
function submit()
255-
{
297+
{
298+
turtle
256299
assertCanCommunicateWithServer $CROMWELL_URL
257300

258301
local response=$(curl --connect-timeout $CURL_CONNECT_TIMEOUT -s -F workflowSource=@${1} ${2:+ -F workflowInputs=@${2}} ${3:+ -F workflowOptions=@${3}} ${4:+ -F workflowDependencies=@${4}} ${CROMWELL_URL}/api/workflows/v1)
@@ -276,6 +319,7 @@ function submit()
276319
# Check the status of a Cromwell job UUID
277320
function status()
278321
{
322+
279323
local retVal=0
280324

281325
assertCanCommunicateWithServer $2
@@ -287,6 +331,12 @@ function status()
287331
r=$?
288332
[[ $r -eq 0 ]] && retVal=1
289333

334+
if [[ $retVal -eq 1 ]]; then
335+
turtle "dead"
336+
else
337+
turtle
338+
fi
339+
290340
cat $f | jq .
291341
checkPipeStatus "Could not read tmp file JSON data." "Could not parse JSON output from cromwell server."
292342

@@ -300,6 +350,7 @@ function status()
300350
# Get the logs of a Cromwell job UUID
301351
function logs()
302352
{
353+
turtle
303354
assertCanCommunicateWithServer $2
304355
curl --connect-timeout $CURL_CONNECT_TIMEOUT -s ${2}/api/workflows/v1/${1}/logs | jq .
305356
checkPipeStatus "Could not connect to Cromwell server." "Could not parse JSON output from cromwell server."
@@ -309,6 +360,7 @@ function logs()
309360
# Get the metadata for a Cromwell job UUID
310361
function metadata()
311362
{
363+
turtle
312364
assertCanCommunicateWithServer $2
313365
curl --connect-timeout $CURL_CONNECT_TIMEOUT --compressed -s ${2}/api/workflows/v1/${1}/metadata?${CROMWELL_METADATA_PARAMETERS} | jq .
314366
checkPipeStatus "Could not connect to Cromwell server." "Could not parse JSON output from cromwell server."
@@ -318,6 +370,7 @@ function metadata()
318370
# Get the metadata in condensed form for a Cromwell job UUID
319371
function slim-metadata()
320372
{
373+
turtle
321374
assertCanCommunicateWithServer $2
322375
curl --connect-timeout $CURL_CONNECT_TIMEOUT --compressed -s "${2}/api/workflows/v1/$1/metadata?includeKey=executionStatus&includeKey=backendStatus" | jq .
323376
checkPipeStatus "Could not connect to Cromwell server." "Could not parse JSON output from cromwell server."
@@ -327,6 +380,7 @@ function slim-metadata()
327380
# Get the status of the given job and how many times it was run
328381
function execution-status-count()
329382
{
383+
turtle
330384
assertCanCommunicateWithServer $2
331385
f=$( makeTemp )
332386
curl --connect-timeout $CURL_CONNECT_TIMEOUT --compressed -s ${2}/api/workflows/v1/$1/metadata?${CROMWELL_METADATA_PARAMETERS} > $f
@@ -348,6 +402,7 @@ function execution-status-count()
348402
# Bring up a browser window to view timing information on the job.
349403
function timing()
350404
{
405+
turtle
351406
echo "Opening timing information in a web browser for job ID: ${1}"
352407
open ${2}/api/workflows/v1/${1}/timing
353408
return $?
@@ -356,6 +411,7 @@ function timing()
356411
# Cancel a running job.
357412
function abort()
358413
{
414+
turtle
359415
assertCanCommunicateWithServer $2
360416
response=$(curl --connect-timeout $CURL_CONNECT_TIMEOUT -X POST --header "Content-Type: application/json" --header "Accept: application/json" "${2}/api/workflows/v1/${1}/abort")
361417
local r=$?
@@ -366,7 +422,7 @@ function abort()
366422
# List all jobs submitted in ${CROMWELL_SUBMISSIONS_FILE}
367423
function list()
368424
{
369-
425+
turtle
370426
local doColor=false
371427
local doUpdate=false
372428

@@ -449,6 +505,7 @@ function list()
449505
# output
450506
function list-outputs()
451507
{
508+
turtle
452509
assertCanCommunicateWithServer $2
453510
local id=$1
454511
local cromwellServer=$2
@@ -476,6 +533,7 @@ function list-outputs()
476533
# Get the root log folder from the cloud and put it in the metadata folder for this run
477534
function fetch-logs()
478535
{
536+
turtle
479537
assertCanCommunicateWithServer $2
480538
local id=$1
481539
local cromwellServer=$2
@@ -511,6 +569,7 @@ function fetch-logs()
511569
# Includes all logs and output files
512570
function fetch-all()
513571
{
572+
turtle
514573
assertCanCommunicateWithServer $2
515574
local id=$1
516575
local cromwellServer=$2
@@ -637,7 +696,7 @@ if ${ISCALLEDBYUSER} ; then
637696

638697
# Special case: notify
639698
if [[ "${SUB_COMMAND}" == "notify" ]] ; then
640-
699+
turtle
641700
# Is the next argument our workflow ID?
642701
# Workflow IDs are standard UUIDs:
643702
if [[ "${1}" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]] ; then

0 commit comments

Comments
 (0)