Task hardware environment
Customizing task resources
You can customize the hardware environment in which your task code executes.
Depending on your needs, there are two different of ways to define and register tasks with their own custom hardware requirements:
- Configuration in the
@union.taskdecorator - Defining a
PodTemplate
Using the @union.task decorator
You can specify requests and limits on:
- CPU number
- GPU number
- Memory size
- Ephemeral storage size
See Customizing task resources for details.
Using PodTemplate
If your needs are more complex, you can use Kubernetes-level configuration to constrain a task to only run on a specific machine type.
In your task definition you then use a PodTemplate that uses the matching node assignment configuration to make sure that the task will only be scheduled on the appropriate machine type.
pod_template and pod_template_name @union.task parameters
The pod_template parameter can be used to supply a custom Kubernetes PodTemplate to the task.
This can be used to define details about node selectors, affinity, tolerations, and other Kubernetes-specific settings.
The pod_template_name is a related parameter that can be used to specify the name of an already existing PodTemplate resource which will be used in this task.
For details see Configuring task pods with Kubernetes PodTemplates.
Accelerators
If you specify GPUs, you can also specify the type of GPU to be used by setting the accelerator parameter.
See
Accelerators for more information.
Task-level monitoring
You can also monitor the hardware resources used by a task. See Task-level monitoring for details.