Jobs
Job tracking for worker computations.
nimbusimage.jobs.Job
A running or completed worker job.
Tracks a Girder Worker job by polling its status. Use wait()
to block until the job finishes, optionally printing progress.
id
property
The Girder job ID.
status
property
Current status code. Call refresh() to update.
status_name
property
Human-readable status name.
log
property
Full job log text, with Girder tokens replaced by
[redacted]. Call refresh() to update.
fetch(gc, job_id)
classmethod
Load a job by id. Raises PermissionError on a 401, like
:meth:refresh.
refresh()
Fetch the latest job status and log from the server.
Raises:
| Type | Description |
|---|---|
PermissionError
|
If the job-status request returns 401. The message says whether the API key lacks the 'List and read jobs' scope (NIM-005) or the token itself was not accepted (expired, or its key revoked). The job itself is unaffected. |
wait(poll_interval=2.0, timeout=None, verbose=True)
Block until the job finishes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
poll_interval
|
float
|
Seconds between status polls. |
2.0
|
timeout
|
float | None
|
Max seconds to wait. None = no limit. |
None
|
verbose
|
bool
|
If True, print status updates to stderr. |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the job succeeded, False otherwise. |
Raises:
| Type | Description |
|---|---|
TimeoutError
|
If timeout is reached before the job finishes. |
PermissionError
|
If polling returns 401; see :meth: |