File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,21 @@ def show(context: Context, args: list):
4343 print (json .dumps (job , indent = 4 ))
4444
4545
46+ def wait (context :Context , args : list ):
47+ if len (args ) != 1 :
48+ print ("ERROR: Invalid parameters. Job ID is required" )
49+ return
50+ gi = connect (context )
51+ state = "Unknown"
52+ waiting = True
53+ while waiting :
54+ job = gi .jobs .show_job (args [0 ], full_details = False )
55+ state = job ["state" ]
56+ if state == "ok" or state == "error" :
57+ waiting = False
58+ print (json .dumps (job , indent = 4 ))
59+
60+
4661def get_value (metric : dict ):
4762 if metric ['name' ] == 'runtime_seconds' :
4863 return metric ['raw_value' ]
Original file line number Diff line number Diff line change 197197 help : kills a job
198198 handler : job.cancel
199199 params : ID
200+ - name : [wait]
201+ help : Wait for a job to finish running
202+ handler : job.wait
203+ params : ID
200204 - name : [ metrics, stats ]
201205 help : display runtime metrics for the job, or a list of jobs contained in a history
202206 handler : job.metrics
You can’t perform that action at this time.
0 commit comments