-
How can I access the attributes of task outputs to be used as inputs to other tasks? For example, below I use a
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Currently,
This should work, and the reason is, this is treated as multiple outputs (tuple), just named. Here is where the tuple opening happens:
https://github.com/flyteorg/flytekit/blob/master/flytekit/core/base_task.py#L273 At runtime (in production, when the cli is invoked), the big call part is bypassed and directly dispatch_execute is invoked. These lines show how to unwrap and handle various outputs: Replying to: USE WITH CAUTION! This only works across non-shared tasks. In Flyte, you can actually reference tasks from other projects and create your own workflow that uses tasks that are declared by others.
We and Spotify and even Freenome use it to create platform tasks that others can simply re-use. |
Beta Was this translation helpful? Give feedback.
Currently,
dataclass
converts the object to a flyteidl.struct / json type. And today flytepropeller cannot open up the struct to pass parts of it to downstream tasks. (This is a feature we have been thinking about, but are afraid that the engine will need to load arbitrary jsons).Thus you can only pass dataclasses as one complete object and cannot access individual variables from it. You can change your code to: