Skip to content

Commit

Permalink
fix failure node example code (#1778)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Wu <[email protected]>
  • Loading branch information
popojk authored Feb 5, 2025
1 parent 02e0dc9 commit efedefd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def superhero_wf(name: str = "Thor", power: str = "Flight") -> str:
# The following example demonstrates how to set the batch size.
from typing import Iterator

from flytekit.types.pickle.pickle import BatchSize
from flytekit.core.type_engine import BatchSize
from typing_extensions import Annotated


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import typing

from flytekit import WorkflowFailurePolicy, task, workflow
from flytekit.types.error.error import FlyteError


@task
Expand All @@ -20,8 +23,8 @@ def delete_cluster(name: str):

# Create a task that will be executed if any of the tasks in the workflow fail
@task
def clean_up(name: str):
print(f"Cleaning up cluster {name}")
def clean_up(name: str, err: typing.Optional[FlyteError] = None):
print(f"Deleting cluster {name} due to {err}")


# Specify the `on_failure` to a cleanup task.
Expand Down

0 comments on commit efedefd

Please sign in to comment.