Get Job Status#
Check the status of a NeMo Safe Synthesizer job to monitor progress and determine when processing is complete.
Prerequisites#
Before you can get the status of a NeMo Safe Synthesizer job, make sure that you have:
Obtained the base URL of your NeMo Safe Synthesizer service
Set the
SAFE_SYN_BASE_URL
environment variable to your NeMo Safe Synthesizer service endpoint
export SAFE_SYN_BASE_URL="https://your-safe-synthesizer-service-url"
To Get the Status of a NeMo Safe Synthesizer Job#
Choose one of the following options to get the status of a NeMo Safe Synthesizer job.
import os
from nemo_microservices import NeMoMicroservices
# Initialize the client
client = NeMoMicroservices(
base_url=os.environ['SAFE_SYN_BASE_URL']
)
job_id = "job-abc123def456"
job_status = client.beta.safe_synthesizer.jobs.get_status(job_id)
print(f"Job ID: {job_id}")
print(f"Status: {job_status}")
# Check if job is completed
if job_status == "completed":
print("Job completed successfully!")
elif job_status == "error":
print("Job failed")
JOB_ID="job-abc123def456"
curl -X GET \
"${SAFE_SYN_BASE_URL}/v1beta1/safe-synthesizer/jobs/${JOB_ID}/status" \
-H 'Accept: application/json'
Example Response
"completed"
Job Status Values#
Jobs can have the following status values:
created: Job has been created and is waiting to start
pending: Job is queued and waiting for resources
active: Job is actively processing data
completed: Job has finished successfully
error: Job encountered an error and stopped
cancelled: Job has been cancelled by the user
cancelling: Job is in the process of being cancelled
paused: Job execution has been paused
pausing: Job is in the process of being paused
resuming: Job is resuming from a paused state
Polling for Completion#
For long-running jobs, you can poll the status at regular intervals:
import time
job_id = "job-abc123def456"
while True:
status = client.beta.safe_synthesizer.jobs.get_status(job_id)
print(f"Job {job_id}: {status}")
if status in ("completed", "error", "cancelled"):
break
# Wait 30 seconds before checking again
time.sleep(30)
print(f"Job finished with status: {status}")
Error Handling#
If a job fails, you can check the logs for detailed error information using the Get Job Logs endpoint.