Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow registration of pipeline-level cleanup funcs #1125

Open
augray opened this issue Jul 26, 2024 · 1 comment
Open

Allow registration of pipeline-level cleanup funcs #1125

augray opened this issue Jul 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@augray
Copy link
Member

augray commented Jul 26, 2024

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
    # ...
@augray augray added the enhancement New feature or request label Jul 26, 2024
@augray
Copy link
Member Author

augray commented Jul 26, 2024

A more general and holistic solution would be to allow future-based try/excepts, but that would be a bigger project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant