Skip to content

Allow registration of pipeline-level cleanup funcs #1125

Open
@augray

Description

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
    # ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions