Open sryza opened 1 year ago
Hi - any progress on this issue?
Any progress on this? Would like to delete a tmp folder after run is complete
Is there anyway to do this currently? Any workarounds?
@judahrand the closest that we have is op-level hooks, but they don't provide the full functionality discussed here. https://docs.dagster.io/concepts/ops-jobs-graphs/op-hooks
Here's a way that one integration has hacked around this: https://github.com/dagster-io/dagster/blob/master/python_modules/libraries/dagster-mlflow/dagster_mlflow/hooks.py#L33
Isn't this what's requested? https://docs.dagster.io/concepts/resources#lifecycle-hooks
When a resource is initialized during a Dagster run, the setup_for_execution method is called. This method is passed an InitResourceContext object, which contains the resource's config and other run information. The resource can use this context to initialize any state it needs for the duration of the run.
Once a resource is no longer needed, the teardown_after_execution method is called. This method is passed the same context object as setup_for_execution. This method can be useful for cleaning up any state that was initialized in setup_for_execution.
setup_for_execution and teardown_after_execution are each called once per run, per process.
It would be useful to be able to run some cleanup code at the end of a run. Examples:
I think it would likely make sense to tie these to resources.
Relevant requests: