gws.base.job.worker

Base job worker.

Source code: gws.base.job.worker

Module Contents

class gws.base.job.worker.Object(root: gws.Root, user: gws.User, job: gws.Job | None = None)

Base job worker.

Subclasses implement a run(root, job) class method, which the job manager calls to run the job. A worker can also run without a job, then job updates are skipped.

jobUid: str

Uid of the job, empty if the worker runs without a job or the job was terminated.

root
user: gws.User

User the job runs for.

get_job() → gws.Job | None

Return the current state of the job.

Returns:

The job, or None if the worker runs without a job.

Raises:

gws.JobTerminated – If the job no longer exists or is not running, e.g. because it was cancelled.

update_job(**kwargs)

Update the job record. Does nothing if the worker runs without a job.

Parameters:

**kwargs – Job fields to update, e.g. state, step, numSteps, stepName or result.

Raises:

gws.JobTerminated – If the job no longer exists or is not running.