lxm3.xm_cluster.JobRequirements

class lxm3.xm_cluster.JobRequirements(resources: Mapping[ResourceType | str, int | str] = immutabledict({}), *, location: str | None = None, **kw_resources: int | str)

Describes the resource requirements of a Job.

task_requirements

Amount of resources needed for a single task within a job.

Type:

lxm3.xm_cluster.requirements.ResourceDict

accelerator

The accelerator the jobs uses, if there is one. Jobs using multiple accelerators are not supported because different kinds of accelerators are usually not installed on the same host.

Type:

lxm3.xm_cluster.requirements.ResourceType | None

topology

Accelerator topology, if an accelerator is used.

location

Place where the job should run. For example a cluster name or a Borg cell.

Type:

str | None

service_tier

A service tier at which the job should run.

replicas

Number of identical tasks to run within a job

__init__(resources: Mapping[ResourceType | str, int | str] = immutabledict({}), *, location: str | None = None, **kw_resources: int | str) None

Define a set of resources.

Parameters:
  • resources – resource amounts as a dictionary, for example {xm.ResourceType.V100: 2}.

  • location – Place where the job should run. For example a cluster name or a Borg cell.

  • **kw_resources – resource amounts as a kwargs, for example v100=2 or ram=1 * xm.GiB. See xm.ResourceType enum for the list of supported types and aliases.

Raises:

ValueError – If several accelerator resources are supplied (i.e. GPU and TPU). If the same resource is passed in a resources dictionary and as a command line argument. If topology is supplied for a non accelerator resource.

Methods

__init__([resources, location])

Define a set of resources.

Attributes

task_requirements

accelerator

location