Skip to content
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

Detect upstream nodes from container nested promises #1707

Merged
merged 3 commits into from
Jun 27, 2023

Conversation

wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented Jun 22, 2023

TL;DR

Upstream nodes were not correctly being detected in cases where the inputs were behind a {} or a []. For example, n1 here

def my_wf(a: int, b: str) -> (int, str):
    x, y = t1(a=a)
    d = t2(a={"key1": b, "key2": y})
    return x, d

would not have picked up n0 as an upstream node because we weren't correctly traversing the structure.

Found while implementing the now rejected generalized container types https://github.com/flyteorg/flytekit/pull/1700/files

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Instead of iterating through the kwargs again, save nodes found while traversing the bindings from the promises.
Also get rid of the mostly duplicate binding_from_flyte_std

Tracking Issue

NA

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
@wild-endeavor wild-endeavor marked this pull request as ready for review June 22, 2023 21:23
@wild-endeavor wild-endeavor changed the title fix upstream nodes Detect upstream nodes from container nested promises Jun 22, 2023
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
pingsutw
pingsutw previously approved these changes Jun 26, 2023
Copy link
Collaborator

@eapolinario eapolinario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth adding a few tests for nested container types (e.g. a list that contains a dictionary, that contains a list, etc) ?

flytekit/core/promise.py Outdated Show resolved Hide resolved


def test_dict_get():
assert DictTransformer.get_dict_types(None) == (None, None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

felt like it was missing, just wanted to be sure it could handle None.

Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
@pingsutw pingsutw merged commit 51d92b0 into master Jun 27, 2023
122 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants