Workloads¶
- class WorkloadClient(beaker: Beaker)[source]¶
Methods for interacting with Beaker Workloads. Accessed via the
Beaker.workload
property.Warning
Do not instantiate this class directly! The
Beaker
client will create one automatically which you can access through the corresponding property.- get(workload: str) Workload [source]¶
- Examples:
>>> with Beaker.from_env() as beaker: ... workload = beaker.workload.get(workload_id)
- Returns:
A
BeakerWorkload
protobuf object.- Raises:
BeakerWorkloadNotFound – If the workload doesn’t exist.
- is_experiment(workload: Workload) bool [source]¶
Returns
True
if an workload is an experiment-type workload.
- is_environment(workload: Workload) bool [source]¶
Returns
True
if an workload is an environment-type (session) workload.
- update(workload: Workload, *, name: str | None = None, description: str | None = None) Workload [source]¶
Update fields of a workload.
- Returns:
The updated
BeakerWorkload
object.
- get_latest_job(workload: Workload, *, task: Task | None = None, finalized: bool | None = None) Job | None [source]¶
Get the latest job of an experiment-type workload.
- Parameters:
task – Filter by a specific task.
finalized – Filter by finalized status.
- Returns:
The latest
BeakerJob
object orNone
, if one hasn’t been created yet.- Raises:
ValueError – If the workload is not an experiment.
- get_results(workload: Workload, *, task: Task | None = None) Dataset | None [source]¶
Get the results
BeakerDataset
from a workload.
- list(*, org: Organization | None = None, author: User | None = None, workspace: Workspace | None = None, created_before: datetime | None = None, created_after: datetime | None = None, finalized: bool | None = None, workload_type: BeakerWorkloadType | None = None, statuses: Iterable[BeakerWorkloadStatus] | None = None, name_or_description: str | None = None, sort_order: BeakerSortOrder | None = None, sort_field: Literal['created'] = 'created', limit: int | None = None) Iterable[Workload] [source]¶
List workloads.
- Returns:
An iterator over
BeakerWorkload
objects.