boundless-lifeguard-61788
09/16/2024, 8:59 PMjolly-florist-66728
09/16/2024, 8:59 PM>>
operator to chain them, ensuring the output of one is passed to the next.
Here's a code snippet illustrating this:
from flytekit import task, workflow
@task
def task_a() -> int:
return 5
@task
def task_b(x: int) -> int:
return x * 2
@workflow
def workflow_a() -> int:
return task_a()
@workflow
def workflow_b(x: int) -> int:
return task_b(x=x)
@workflow
def chained_workflow() -> int:
result_a = workflow_a()
result_b = workflow_b(x=result_a)
return result_b
In this example:
- workflow_a
returns an integer.
- workflow_b
takes an integer as input and returns an integer.
- chained_workflow
chains workflow_a
and workflow_b
, passing the output of workflow_a
to workflow_b
.
Would you like more detail on any specific part?
Sources:
- Chaining Flyte entities 👍 0 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.boundless-lifeguard-61788
09/16/2024, 9:01 PM