Experiment Spec Types¶
Python classes for the corresponding Beaker Experiment Spec API.
- class BeakerExperimentSpec(version: ~beaker.types.BeakerSpecVersion = BeakerSpecVersion.v2, description: str | None = None, tasks: list[~beaker.types.BeakerTaskSpec] = <factory>, budget: str | None = None, retry: ~beaker.types.BeakerRetrySpec | None = None)[source]¶
Defines an experiment workload.
Tip
See the spec format for an explanation of the fields.
- version: BeakerSpecVersion = 'v2'¶
- tasks: list[BeakerTaskSpec]¶
- retry: BeakerRetrySpec | None = None¶
- classmethod from_file(path: PathLike | str) BeakerExperimentSpec [source]¶
Load a
BeakerExperimentSpec
from a YAML file.
- classmethod from_json(data: dict[str, Any]) BeakerExperimentSpec [source]¶
Load a
BeakerExperimentSpec
from a JSON-compatible dictionary.
- classmethod new(*, budget: str | None = None, task_name: str = 'main', description: str | None = None, cluster: str | list[str] | None = None, beaker_image: str | None = None, docker_image: str | None = None, result_path: str = '/unused', priority: BeakerJobPriority | str | None = None, **kwargs) BeakerExperimentSpec [source]¶
A convenience method for quickly creating a new
BeakerExperimentSpec
.
- with_task(task: BeakerTaskSpec) BeakerExperimentSpec [source]¶
Returns a new spec with an additional task.
- with_description(description: str) BeakerExperimentSpec [source]¶
Returns a new spec with the given description.
- with_retries(allowed_task_retries: int) BeakerExperimentSpec [source]¶
Returns a new spec with the given retries.
- class BeakerTaskSpec(image: BeakerImageSource, context: BeakerTaskContext, result: BeakerResultSpec | None, constraints: BeakerConstraints | None = None, name: str | None = None, command: list[str] | None = None, arguments: list[str] | None = None, env_vars: list[BeakerEnvVar] | None = None, datasets: list[BeakerDataMount] | None = None, resources: BeakerTaskResources | None = None, host_networking: bool = False, replicas: int | None = None, leader_selection: bool | None = False, propagate_failure: bool | None = None, propagate_preemption: bool | None = None, synchronized_start_timeout: int | None = None, timeout: int | None = None)[source]¶
See the Task spec docs for an explanation of the fields.
- image: BeakerImageSource¶
- context: BeakerTaskContext¶
- result: BeakerResultSpec | None¶
- constraints: BeakerConstraints | None = None¶
- env_vars: list[BeakerEnvVar] | None = None¶
- datasets: list[BeakerDataMount] | None = None¶
- resources: BeakerTaskResources | None = None¶
- classmethod new(name: str, cluster: str | list[str] | None = None, beaker_image: str | None = None, docker_image: str | None = None, result_path: str = '/unused', priority: BeakerJobPriority | str | None = None, preemptible: bool | None = None, **kwargs) BeakerTaskSpec [source]¶
- with_image(**kwargs) BeakerTaskSpec [source]¶
- with_result(**kwargs) BeakerTaskSpec [source]¶
- with_context(**kwargs) BeakerTaskSpec [source]¶
- with_name(name: str) BeakerTaskSpec [source]¶
- with_resources(**kwargs) BeakerTaskSpec [source]¶
- with_dataset(mount_path: str, **kwargs) BeakerTaskSpec [source]¶
- with_env_var(name: str, value: str | None = None, secret: str | None = None) BeakerTaskSpec [source]¶
- with_constraint(**kwargs: list[str]) BeakerTaskSpec [source]¶
- class BeakerImageSource(beaker: str | None = None, docker: str | None = None)[source]¶
See the ImageSource spec docs for an explanation of the fields.
- class BeakerEnvVar(name: str, value: str | None = None, secret: str | None = None)[source]¶
See the EnvVar spec docs for an explanation of the fields.
- class BeakerDataSource(beaker: str | None = None, host_path: str | None = None, weka: str | None = None, result: str | None = None, secret: str | None = None)[source]¶
See the DataSource spec docs for an explanation of the fields.
- class BeakerDataMount(source: BeakerDataSource, mount_path: str, sub_path: str | None = None)[source]¶
See the DataMount spec docs for an explanation of the fields.
- source: BeakerDataSource¶
- class BeakerResultSpec(path: str)[source]¶
See the ResultSpec docs for an explanation of the fields.
- class BeakerTaskResources(cpu_count: float | None = None, gpu_count: int | None = None, memory: str | None = None, shared_memory: str | None = None)[source]¶
See the TaskResources spec docs for an explanation of the fields.
- class BeakerTaskContext(cluster: str | None = None, priority: BeakerJobPriority | None = None, preemptible: bool | None = None)[source]¶
See the Context spec docs for an explanation of the fields.
- priority: BeakerJobPriority | None = None¶
- class BeakerRetrySpec(allowed_task_retries: int | None = None)[source]¶
See the Retry spec docs for an explanation of the fields.