glamorous-pizza-44029
03/24/2025, 1:13 PM@task(
task_config=PodTemplate(
pod_spec=V1PodSpec(
containers=[
client.V1Container(
name="main",
volume_mounts=[
client.V1VolumeMount(
name="shared-volume", mount_path="/mnt/shared-volume"
)
]
)
],
volumes=[
client.V1Volume(
name="shared-volume",
persistent_volume_claim=client.V1PersistentVolumeClaimVolumeSource(
claim_name=pvc_name, # The problem is here <---
),
)
]
),
)
)
def consume_pvc_task(pvc_name: str) -> str:
...
Is there some way top access the pvc_name variable in the task decorator? Is what I am trying to do even possible or do I need to use kubernetes APIs to mount the volume and there is no native way in Flyte to do this dynamically?
Thanks!glamorous-pizza-44029
03/25/2025, 8:24 AMglamorous-pizza-44029
03/25/2025, 9:29 AMgentle-tomato-480
03/25/2025, 9:31 AMgentle-tomato-480
03/25/2025, 9:41 AMgentle-tomato-480
03/25/2025, 9:44 AMglamorous-pizza-44029
03/25/2025, 9:47 AMgentle-tomato-480
03/25/2025, 9:56 AMglamorous-pizza-44029
03/25/2025, 9:57 AMgentle-tomato-480
03/25/2025, 10:00 AMgentle-tomato-480
03/25/2025, 10:55 AMglamorous-pizza-44029
03/25/2025, 11:03 AMgentle-tomato-480
03/25/2025, 11:35 AMgentle-tomato-480
03/25/2025, 11:38 AMglamorous-pizza-44029
03/25/2025, 2:41 PMwith_overrides
with a pod_template, which kind of works, but still not perfectly. I can pass a variable to this...but the variable can only be defined within the workflow, and not passed from a parent workflow. If it is passed from a parent_workflow, it breaks because the variable is suddenly a promise, and you cannot pass a promise to a PodSpec.
So...still stuck at the moment with no way to dynamically create disk volumes and use them in Flyte natively (unless someone else has an idea on how to do this).
Otherwise I have to probably do this via the kubernetes API directly instead and mount the volume within a task šgentle-tomato-480
03/25/2025, 3:03 PMgentle-tomato-480
03/25/2025, 3:04 PMgentle-tomato-480
03/25/2025, 3:14 PMglamorous-pizza-44029
03/25/2025, 4:16 PMgentle-tomato-480
03/25/2025, 4:19 PMglamorous-pizza-44029
03/25/2025, 4:21 PMcareful-australia-19356
03/25/2025, 4:24 PM.with_overrides
supporting a PVC as argument right?glamorous-pizza-44029
03/25/2025, 4:27 PMhoc_workflow
gentle-tomato-480
03/25/2025, 4:32 PMgentle-tomato-480
03/25/2025, 4:33 PMcareful-australia-19356
03/25/2025, 4:59 PM@eager
glamorous-pizza-44029
03/25/2025, 5:01 PMgentle-tomato-480
03/25/2025, 5:04 PMglamorous-pizza-44029
03/25/2025, 5:10 PMgentle-tomato-480
03/25/2025, 5:18 PMgentle-tomato-480
03/25/2025, 5:21 PMglamorous-pizza-44029
03/26/2025, 2:00 PM@dynamic
with a few wrapper workflows.
Workflow #1: Call Task to generate the Disk Name, call on_failure handler workflow
Workflow #2: Simply used for on_error handler (since @dynamic does not support on_failure)
Dynamic Workflow: Do the rest of the logic
Since the dynamic workflow is not actually using promises (which became more clear from the eager documentation) and has real python variables, I can actually use with_overrides
correctly šgentle-tomato-480
03/26/2025, 2:01 PMgentle-tomato-480
03/26/2025, 2:01 PM