Job Status#
Check if a job is still running or completed.
by Silvia Mazzoni, DesignSafe, 2025
The getJobStatus Tapis command is your direct way to check where a Tapis job is in its lifecycle — whether it’s still queued, running, finished, or failed.
Why use getJobStatus(uuid)?#
This is a very simple, lightweight Tapis call that returns only the current state of your job. You might use it when:
You’ve just submitted a job and want to check programmatically if it’s still waiting in the queue or actively running.
Your job is marked FINISHED, and now you want to trigger a script to move output data or start post-processing.
Your job shows a FAILED status — you can then call
getJobHistory()or examine output logs to debug what went wrong.
While you can always view job statuses on the DesignSafe Job Status web page, using getJobStatus in Python or a Jupyter notebook lets you:
Build automated checks or dashboards,
Loop until a job finishes before downloading outputs,
Or trigger follow-up workflows without manual intervention.
Typical status values#
Depending on your compute environment and the app you’ve submitted, getJobStatus might return:
Status |
What it means |
|---|---|
|
Waiting to be scheduled in the queue. |
|
Preparing input data. |
|
Actively executing on the compute nodes. |
|
Copying output data to your archive location. |
|
Successfully completed. |
|
Job did not complete successfully. |
|
Job was manually terminated. |
Example usage#
status = t.jobs.getJobStatus(jobUuid)
print("Current job status:", status.status)
This simply prints something like:
Current job status: RUNNING
In short:
getJobStatus gives you a snapshot of the job’s current state, which is essential for building smart scripts that monitor or chain together different compute steps.
Using local utilities library
Connect to Tapis#
Yes, you need to first connect to Tapis, this authenticates you
t=OpsUtils.connect_tapis()
-- Checking Tapis token --
Token loaded from file. Token is still valid!
Token expires at: 2025-08-21T02:49:32+00:00
Token expires in: 3:39:37.622786
-- LOG IN SUCCESSFUL! --
Get Job Status from Tapis#
Purpose: Get the current status only (lightweight).
User Input – job id#
jobUuid = '4dfa35e1-15cd-48fd-a090-f348544dee1f-007'
JobStatus = t.jobs.getJobStatus(jobUuid=jobUuid)
print('status:',JobStatus.status)
if hasattr(JobStatus, "message"):
print('message:',JobStatus.message)
status: FINISHED
Python function#
get_tapis_job_status.py
# ../OpsUtils/OpsUtils/Tapis/get_tapis_job_status.py
def get_tapis_job_status(t, jobUuid, print_all=True, return_values=False):
"""
Retrieve and optionally display the status of a Tapis job.
Summary
-------
Queries the Tapis Jobs service for the current status of the job identified by
`jobUuid`. By default, prints the status in an expandable Jupyter widget with
details including the job's UUID, current state, and any associated message.
Parameters
----------
t : tapipy.tapis.Tapis
Authenticated Tapis client instance.
jobUuid : str
The UUID of the Tapis job to query.
print_all : bool, default True
If True, display status and details in a Jupyter accordion widget.
If False, suppress printing.
return_values : bool, default False
If True, return the `JobStatus` object from Tapis.
If False, return None.
Returns
-------
tapipy.tapis.TapisResult or None
- If `return_values` is True, returns the Tapis job status object.
- Otherwise, returns None.
Notes
-----
When `print_all` is True, the output includes:
* The job UUID
* The raw job status object
* An optional `message` field from the Tapis status
* Error message summary (via `OpsUtils.get_tapis_job_history_data`)
Example
-------
>>> get_tapis_job_status(t, "1234-uuid-5678")
++++++++++++++++++++++++++++++
++++++ Job Status ++++++
++++++++++++++++++++++++++++++
jobUuid: 1234-uuid-5678
Job Status: TapisResult(...)
++++++++++++++++++++++++++++++
Author
------
Silvia Mazzoni, DesignSafe (silviamazzoni@yahoo.com)
Date
----
2025-08-14
Version
-------
1.0
"""
# Silvia Mazzoni, 2025
from OpsUtils import OpsUtils
JobStatus = t.jobs.getJobStatus(jobUuid=jobUuid)
if print_all:
import ipywidgets as widgets
from IPython.display import display
this_out = widgets.Output()
this_accordion = widgets.Accordion(children=[this_out])
this_accordion.set_title(0, f'Job STATUS ({jobUuid})')
this_accordion.selected_index = 0
display(this_accordion)
with this_out:
print('+' * 30)
print(f'++++++ Job Status ++++++')
print('+' * 30)
print(f'jobUuid: {jobUuid}')
print(f'Job Status: {JobStatus}')
print('+' * 30)
if hasattr(JobStatus, "message"):
print('message:', JobStatus.message)
print('+' * 30)
OpsUtils.get_tapis_job_history_data(
t, jobUuid,
print_out=False,
return_data=False,
get_job_error_message=True
)
if return_values:
return JobStatus
else:
return
Finished Job#
jobUuid = '4dfa35e1-15cd-48fd-a090-f348544dee1f-007'
JobStatus = OpsUtils.get_tapis_job_status(t,jobUuid)
Failed Job#
jobUuid = 'b35ab3c2-0436-4c98-9066-367b9db67f9c-007'
JobStatus = OpsUtils.get_tapis_job_status(t,jobUuid)