-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flytekit] Support attribute access on promises #1825
[flytekit] Support attribute access on promises #1825
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1825 +/- ##
==========================================
- Coverage 54.71% 54.62% -0.10%
==========================================
Files 305 306 +1
Lines 22732 22890 +158
Branches 3453 3478 +25
==========================================
+ Hits 12438 12503 +65
- Misses 10122 10215 +93
Partials 172 172
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Will take another pass tomorrow morning.
Thanks for adding those great unit tests!
cbb7daa
to
faae057
Compare
1732e26
to
509b2dd
Compare
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
Signed-off-by: byhsu <[email protected]>
3a074f6
to
a543bb4
Compare
Signed-off-by: byhsu <[email protected]>
Support attribute access on promises In the following workflow: - `basic_workflow` contains trivial examples to access output attributes - `failed_workflow` contains examples that causes exception (e.g. out of range) - `advanced_workflow` contains examples with more complex attribute access ```python from dataclasses import dataclass from typing import Dict, List, NamedTuple from dataclasses_json import dataclass_json from flytekit import WorkflowFailurePolicy, task, workflow @dataclass_json @DataClass class foo: a: str @task def t1() -> (List[str], Dict[str, str], foo): return ["a", "b"], {"a": "b"}, foo(a="b") @task def t2(a: str) -> str: print("a", a) return a @task def t3() -> (Dict[str, List[str]], List[Dict[str, str]], Dict[str, foo]): return {"a": ["b"]}, [{"a": "b"}], {"a": foo(a="b")} @task def t4(a: List[str]): print("a", a) @task def t5(a: Dict[str, str]): print("a", a) @workflow def basic_workflow(): l, d, f = t1() t2(a=l[0]) t2(a=d["a"]) t2(a=f.a) @workflow( # The workflow doesn't fail when one of the nodes fails but other nodes are still executable failure_policy=WorkflowFailurePolicy.FAIL_AFTER_EXECUTABLE_NODES_COMPLETE ) def failed_workflow(): # This workflow is supposed to fail due to exceptions l, d, f = t1() t2(a=l[100]) t2(a=d["b"]) t2(a=f.b) @workflow def advanced_workflow(): dl, ld, dd = t3() t2(a=dl["a"][0]) t2(a=ld[0]["a"]) t2(a=dd["a"].a) t4(a=dl["a"]) t5(a=ld[0]) ``` Signed-off-by: byhsu <[email protected]>
See flyteorg/flyteidl#439
Tracking Issue
flyteorg/flyte#3864
Testing
In the following workflow:
basic_workflow
contains trivial examples to access output attributesfailed_workflow
contains examples that causes exception (e.g. out of range)advanced_workflow
contains examples with more complex attribute accessLocal execution
Remote Execution
basic
failed
advanced