loud-keyboard-72751
05/07/2024, 9:52 AMaverage-finland-92144
05/07/2024, 6:19 PMdefault-pod-template
for this (docs). Is it what you're looking for? If so, any particular struggle using it?
2. Even on-prem, your GPU device driver should be exposing a supported toleration (like the one shown in this section). Is it OpenShift? or vanilla K8s on RHEL?loud-keyboard-72751
05/07/2024, 6:21 PMloud-keyboard-72751
05/07/2024, 6:22 PMloud-keyboard-72751
05/07/2024, 6:22 PMaverage-finland-92144
05/07/2024, 11:41 PMfrom flytekit import task, workflow
from flytekitplugins.pod import Pod
from kubernetes.client.models import V1Container, V1PodSpec, V1ResourceRequirements, V1Volume, V1VolumeMount
# Define the shared volume
shared_volume = V1Volume(
name="shared-data",
empty_dir={}
)
# Define the volume mount
shared_volume_mount = V1VolumeMount(
name="shared-data",
mount_path="/data"
)
# Define the pod spec with two containers
pod_spec = V1PodSpec(
containers=[
V1Container(
name="primary",
image="primary-image:latest",
resources=V1ResourceRequirements(
requests={"cpu": "1", "memory": "100Mi"},
limits={"cpu": "1", "memory": "100Mi"}
),
volume_mounts=[shared_volume_mount],
command=["sh", "-c", "echo 'Hello from primary container' && sleep 30"]
),
V1Container(
name="secondary",
image="secondary-image:latest",
command=["sh", "-c", "echo 'Hello from secondary container' > /data/message.txt"],
volume_mounts=[shared_volume_mount]
)
],
volumes=[shared_volume]
)
# Define the task using the Pod plugin
@task(task_config=Pod(pod_spec=pod_spec))
def pod_task() -> str:
with open("/data/message.txt", "r") as f:
return f.read()
# Define the workflow
@workflow
def pod_workflow() -> str:
return pod_task()
it's strange, it respects the image for the secondary
container but overrides it for the primary
And BTW, it respects the container namesloud-keyboard-72751
05/08/2024, 5:08 AMloud-keyboard-72751
05/08/2024, 5:09 AMaverage-finland-92144
05/08/2024, 1:49 PMloud-keyboard-72751
05/08/2024, 1:54 PMloud-keyboard-72751
05/08/2024, 1:54 PMloud-keyboard-72751
05/08/2024, 1:57 PM