Better output of job status

This commit is contained in:
Joshua Boniface 2020-01-04 14:45:40 -05:00
parent aa2bb7c94c
commit 089b3d7a43
1 changed files with 10 additions and 3 deletions

View File

@ -636,18 +636,25 @@ def task_status(config, task_id):
retvalue = True retvalue = True
respjson = response.json() respjson = response.json()
job_state = respjson['state'] job_state = respjson['state']
if job_state == 'PENDING':
retdata = 'Job state: PENDING'
if job_state == 'RUNNING': if job_state == 'RUNNING':
retdata = 'Job state: RUNNING\nStage: {}/{}\nStatus: {}'.format( retdata = 'Job state: RUNNING\nStage: {}/{}\nStatus: {}'.format(
respjson['current'], respjson['current'],
respjson['total'], respjson['total'],
respjson['status'] respjson['status']
) )
if job_state == 'FAILED': elif job_state == 'FAILED':
retdata = 'Job state: FAILED\nStatus: {}'.format( retdata = 'Job state: FAILED\nStatus: {}'.format(
respjson['status'] respjson['status']
) )
elif job_state == 'COMPLETED':
retdata = 'Job state: COMPLETED\nStatus: {}'.format(
respjson['status']
)
else:
retdata = 'Job state: {}\nStatus: {}'.format(
respjson['state'],
respjson['status']
)
else: else:
retvalue = False retvalue = False
retdata = response.json()['message'] retdata = response.json()['message']