Cancel a job¶
Stop a job that hasn't started grading yet. Cancelling costs nothing.
cancel_job.py
# cancel_job.py - stop a job before grading starts
# usage: python cancel_job.py <job id>
import os
import sys
import time
from centific import PhysicalAI
client = PhysicalAI(
api_key = os.environ["CENTIFIC_API_KEY"],
base_url = "https://humanoidiq-dev.centific.com",
)
job = client.qc.get(sys.argv[1])
print("before:", job.status)
job.cancel()
time.sleep(3)
print("after :", client.qc.get(job.id).status) # read it back to be sure
How to use it¶
When you can cancel¶
| You can cancel | You can't cancel |
|---|---|
| awaiting_upload uploaded queued | grading complete failed |
If the job can't be cancelled, its status stays the same.
Sample output¶
A cancelled job can't be restarted
To grade the same data, run Create a job or Upload only again.