Skip to content

Commit 4867a01

Browse files
authored
Exit hooks (#152)
* add exit hook docs * add a note about @exit_hook(options=) * improve custom deco docs
1 parent 01d648c commit 4867a01

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

docs/metaflow/composing-flows/custom-decorators.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ python waiterflow.py run --with myprofiler.my_profile
107107

108108
Custom decorators don't require special treatment when [executing tasks in
109109
the cloud](/scaling/remote-tasks/introduction) or when [deploying flows to production](/production/introduction) -
110-
they will get [packaged automatically by Metaflow](/scaling/dependencies#unpacking-a-metaflow-project). Try it:
110+
they will get [packaged automatically by Metaflow](/scaling/dependencies#unpacking-a-metaflow-project). You don't
111+
even need to `import` the decorators if you add them with `--with`. Try it:
112+
111113
```
112114
python waiterflow.py run --with myprofiler.my_profile --with kubernetes
113115
```

docs/metaflow/composing-flows/mutators.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ You can test the effect of the options with `@robust_flow` above. You can see th
122122
python failflow.py dump RUN_ID/start
123123
```
124124

125+
Note that the same options apply to adding flow-level decorators as well.
126+
125127
## Introspecting a flow and applying configs
126128

127129
Let's walk through a more advanced mutator that shows how you can

docs/scaling/failures.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,15 @@ if __name__ == "__main__":
383383
Note that when deployed on Argo Workflows, exit hook functions execute as separate
384384
containers (pods), so they will execute even if steps fail e.g. due to out of memory condition.
385385

386+
### Custom dependencies in exit hooks
387+
388+
Since exit hook functions are not steps, you can't use `@pypi` or `@conda` to manage
389+
their dependencies.
390+
Instead, you can provide a custom image in `options={'image': ...}` like here:
391+
```
392+
@exit_hook(on_error=[failure_print], options={"image": URL_TO_AN_IMAGE})
393+
```
394+
386395
## Summary
387396

388397
Here is a quick summary of failure handling in Metaflow:

0 commit comments

Comments
 (0)