To allow cleanup of resources even if the pipeline crashes. A possible API:
@sematic.func
def do_foo(x: float, bar: str) -> Output:
some_resource = create_resource(x, bar) # create_resource is NOT a func
sematic.on_cleanup(clean_some_resource(resource.id)) # arguments to cleanup funcs must be resolved at call time
# ...
return output
@sematic.func
def clean_some_resource(resource_id: str) -> None: # cleanup funcs must return None
# ...
To allow cleanup of resources even if the pipeline crashes. A possible API: