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

Moving from flytepropeller - Check for None values in branch nodes #4154

Closed
wants to merge 11 commits into from

Conversation

eapolinario
Copy link
Contributor

TL;DR

blocked by flyteorg/flytekit#1747
Add support comparison (EQ and NEQ) between nil and non-nil values in the branch nodes.

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

import random
import typing
from flytekit import conditional, task, workflow


@task
def coin_toss(seed: int) -> typing.Optional[bool]:
    r = random.Random(seed)
    if r.random() < 0.5:
        return True
    return None


@task
def failed() -> int:
    return -1


@task
def success() -> int:
    return 0


@workflow
def wf(seed: int = 5) -> int:
    result = coin_toss(seed=seed)
    return conditional("test").if_(result.is_none()).then(success()).else_().then(failed())


if __name__ == '__main__':
    wf()
image

Tracking Issue

#3514

Follow-up issue

NA

pingsutw and others added 11 commits July 19, 2023 15:02
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (d9586b0) 58.98% compared to head (009f5c7) 63.31%.

❗ Current head 009f5c7 differs from pull request most recent head dfd74be. Consider uploading reports for the commit dfd74be to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4154      +/-   ##
==========================================
+ Coverage   58.98%   63.31%   +4.33%     
==========================================
  Files         619      190     -429     
  Lines       52804    12489   -40315     
==========================================
- Hits        31146     7908   -23238     
+ Misses      19174     3859   -15315     
+ Partials     2484      722    -1762     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 597 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants