microscopic-needle-82602
04/02/2025, 12:04 PMjolly-florist-66728
04/02/2025, 12:04 PMPodTemplate
class from flytekit
. This allows you to specify Kubernetes-specific configurations such as tolerations. Here's an example of how to do it:
from flytekit import PodTemplate, Resources, task
from kubernetes.client import V1Container, V1PodSpec, V1Toleration
@task(
requests=Resources(cpu="0.1", mem="128Mi"),
limits=Resources(cpu="0.2", mem="256Mi"),
pod_template=PodTemplate(
primary_container_name="primary",
pod_spec=V1PodSpec(
containers=[
V1Container(
name="primary",
image="hello-world",
),
],
tolerations=[
V1Toleration(
key="app",
operator="Equal",
value="flyte",
effect="NoSchedule",
),
],
),
),
)
def my_task() -> None:
print("Task with tolerations")
This code sets a toleration on the task's pod, allowing it to be scheduled on nodes with a matching taint. Would you like more detail on this process?
Sources:
- GitHub Issue: Spark Task tolerations not applied with PodTemplate 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
04/02/2025, 12:41 PMjolly-florist-66728
04/02/2025, 12:41 PMmicroscopic-needle-82602
04/02/2025, 12:46 PMjolly-florist-66728
04/02/2025, 12:46 PMcontainer_image
parameter in the @task
decorator, that image will be used for the task execution. If you do not specify a container_image
in the task definition, Flyte will use the default image specified during the registration process or the default image configured in your Flyte deployment.
In your example, if you register the workflow with a specific image name using the --image
flag during registration, that image will be used for the task unless overridden by a container_image
parameter in the task definition. If container_image
is not specified in the task, the image provided during registration will be used.
Would you like more detail on how to specify images for tasks or workflows?
Sources:
- Flyte documentation on ImageSpec
- Flyte documentation on multiple images in a workflow 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.microscopic-needle-82602
04/02/2025, 1:15 PMjolly-florist-66728
04/02/2025, 1:15 PM