TECHNOLOGY

Kubeflow ExitHandler: cleanup needs failure-aware inputs, not presumed successful model outputs

In this article
THE QUICK TAKE

An exit handler can run after failed work; its own input contract must not depend on an output that the failed task never produced.

Cleanup starts after training produced no model

A pipeline allocates a temporary evaluation resource, trains a model and cleans up afterward. The cleanup task is placed in an exit handler but expects the successful model output as its only source of the resource identifier. If training fails before producing that output, the design has made failure recovery depend on the successful path.

Identify cleanup inputs before launching the fragile operation. A stable resource identity and the model’s final artifact are different values. Keeping them separate makes cleanup explainable when the model artifact never exists.

Exit handling covers the scoped work

The control-flow guide describes ExitHandler as running an exit task after scoped tasks finish, including failure. That ordering is valuable, but the cleanup component still needs a valid interface under those failure conditions.

Do not equate scheduled cleanup with completed cleanup or with automatic rollback of all external effects. The handler executes application code; that code and the destination resource API determine which actions actually succeed.

Final status is a distinct input channel

The DSL reference documents PipelineTaskFinalStatus for status information supplied by the backend. Use it to interpret the outcome rather than inventing a success artifact when the preceding task failed. Follow the documented construction rules for that special input.

Keep identifiers needed for cleanup in a path that remains available independently of model training. Terminal request consistency illustrates why a task’s final state and the state of an external operation need separate evidence.

Artifact absence can be an expected failure result

The artifact guide describes outputs written by components. Failure before output publication may leave no usable model artifact. Cleanup should not treat that absence as a valid model or as proof that no external resource was allocated earlier.

Record which resource was created and which component owns its release. Avoid reconstructing that relationship from a mutable latest artifact reference after a failure. Historical model identity is useful for evaluation, while cleanup identity belongs to the resource lifecycle.

Test the early-failure case

Exercise a controlled failure before model output creation, and inspect whether the exit task receives usable status and resource information. Verify the actual external resource state after cleanup instead of checking only that the exit task appeared in the graph.

Dataset removal lineage provides a related way to document intentional absence. The final run evidence should explain what failed, what was released and which artifacts are unavailable, without presenting cleanup completion as successful training.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles