Skip to content

Commit

Permalink
Add on failure node passing err message doc (#6209)
Browse files Browse the repository at this point in the history
* amend doc

Signed-off-by: Alex Wu <[email protected]>

* fix doc reference code lines

Signed-off-by: Alex Wu <[email protected]>

---------

Signed-off-by: Alex Wu <[email protected]>
  • Loading branch information
popojk authored Feb 12, 2025
1 parent 592f1c4 commit d3a34ed
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/user_guide/development_lifecycle/failure_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ To clone and run the example code on this page, see the [Flytesnacks repo][flyte

```{literalinclude} /examples/development_lifecycle/development_lifecycle/failure_node.py
:caption: development_lifecycle/failure_node.py
:lines: 1-6
:lines: 1-7
```

Create a task that will fail during execution:

```{literalinclude} /examples/development_lifecycle/development_lifecycle/failure_node.py
:caption: development_lifecycle/failure_node.py
:lines: 10-18
:lines: 11-19
```

Create a task that will be executed if any of the tasks in the workflow fail:
Expand All @@ -42,7 +42,8 @@ Create a task that will be executed if any of the tasks in the workflow fail:
Specify the `on_failure` to a cleanup task. This task will be executed if any of the tasks in the workflow fail:

:::{note}
The input of `clean_up` should be the exact same as the input of the workflow.
The inputs of `clean_up` must exactly match the workflow's inputs. Additionally, the `err` parameter will be
populated with the error message encountered during execution.
:::

```{literalinclude} /examples/development_lifecycle/development_lifecycle/failure_node.py
Expand All @@ -54,7 +55,7 @@ By setting the failure policy to `FAIL_AFTER_EXECUTABLE_NODES_COMPLETE` to ensur

```{literalinclude} /examples/development_lifecycle/development_lifecycle/failure_node.py
:caption: development_lifecycle/failure_node.py
:lines: 42-53
:lines: 43-54
```

You can also set the `on_failure` to a workflow. This workflow will be executed if any of the tasks in the workflow fail:
Expand Down

0 comments on commit d3a34ed

Please sign in to comment.