Skip to main content
The Jobs Service in the Galtea SDK lets you inspect and cancel asynchronous Galtea jobs — for example, the inference-generation pipeline started by evaluations.run() in endpoint-connection mode. This Service is exposed by the galtea.jobs object.
Remember that we will be using the galtea object. More information here.

What is a Job?

When you call evaluations.run() without an agent, Galtea queues an inference batch and returns a jobId. The platform then calls your endpoint for every test case and evaluates the results asynchronously. The Jobs Service gives you visibility into that background process and lets you cancel it if needed. A job moves through the following states:
StateMeaning
waitingQueued and waiting for a worker
delayedScheduled to run in the future
prioritizedPromoted ahead of normal queue items
waiting-childrenWaiting for sub-jobs to complete
activeCurrently being processed by a worker
completedFinished successfully
failedFinished with an error
cancelledCancelled by a user call to cancel()

Quick Example

Check job status and cancel if it is still running:
    # Check whether the job is still running before deciding to cancel
    status = galtea.jobs.get_status(job_id=job_id)
    print(f"Job state: {status.state}  progress: {status.progress}")

    terminal_states = {"completed", "failed", "cancelled"}
    if status.state not in terminal_states:
        try:
            response = galtea.jobs.cancel(job_id=job_id)
            print(f"Cancelled job {response.id}")
        except JobAlreadyTerminalException:
            # The job reached a terminal state between the get_status call and cancel — safe to ignore
            print("Job completed before the cancel request arrived.")
    else:
        print(f"Job already in terminal state: {status.state}")

Service Methods