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

[easy] Show failed_node_id in failure node local execution #2334

Merged
merged 4 commits into from
Apr 7, 2024

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Apr 6, 2024

Tracking issue

flyteorg/flyte#1506

Why are the changes needed?

Better user experience.

What changes were proposed in this pull request?

unit tests, local execution and debugger

reference: https://realpython.com/lessons/mocking-print-unit-tests/

How was this patch tested?

Setup process

pyflyte run kevin_example.py wf2 
# source: https://github.com/flyteorg/flyte/pull/4308
import typing
from click.testing import CliRunner

from flytekit import task, workflow, WorkflowFailurePolicy
from flytekit.clis.sdk_in_container import pyflyte
from flytekit.types.error.error import FlyteError

@task()
def create_cluster(name: str):
    print(f"Creating cluster: {name}")


@task()
def t1(a: int, b: str):
    print(f"{a} {b}")
    raise ValueError("Fail!")


@task()
def delete_cluster(name: str, err: typing.Optional[FlyteError] = None):
    print(f"Deleting cluster {name}")
    print(err)


@task()
def clean_up(name: str, err: typing.Optional[FlyteError] = None):
    print(f"Deleting cluster {name} due to {err}")
    print("This is err:", err)


@workflow(on_failure=clean_up)
def subwf(name: str = "kevin"):
    c = create_cluster(name=name)
    t = t1(a=1, b="2")
    d = delete_cluster(name=name)
    c >> t >> d


@workflow(on_failure=clean_up, failure_policy=WorkflowFailurePolicy.FAIL_AFTER_EXECUTABLE_NODES_COMPLETE)
def wf1(name: str = "kevin"):
    c = create_cluster(name=name)
    subwf(name="pingsutw")
    t = t1(a=1, b="2")
    d = delete_cluster(name=name)
    c >> t >> d

@workflow(on_failure=clean_up)
def wf2(name: str = "kevin"):
    c = create_cluster(name=name)
    t = t1(a=1, b="2")
    d = delete_cluster(name=name)
    c >> t >> d

Screenshots

image image

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 6, 2024
Copy link

codecov bot commented Apr 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.04%. Comparing base (b475c87) to head (028667b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2334      +/-   ##
==========================================
- Coverage   83.09%   83.04%   -0.05%     
==========================================
  Files         324      324              
  Lines       24860    24861       +1     
  Branches     3761     3547     -214     
==========================================
- Hits        20657    20646      -11     
- Misses       3582     3592      +10     
- Partials      621      623       +2     

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

Signed-off-by: Future-Outlier <[email protected]>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 6, 2024
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
@dosubot dosubot bot added the lgtm This PR has been approved by maintainer label Apr 6, 2024
@Future-Outlier Future-Outlier merged commit bf38b8e into master Apr 7, 2024
48 of 49 checks passed
@Future-Outlier Future-Outlier deleted the workflow-failure-node-execution-enhancement branch April 11, 2024 04:23
fiedlerNr9 pushed a commit that referenced this pull request Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants