Hello Everyone! Does anyone have an idea or maybe ...
# questions
p
Hello Everyone! Does anyone have an idea or maybe an implementation of a hook in Kedro that would kick off at KeyboardInterrupt of a pipeline? I would love to use one for cleanup of certain files and during dev phase of pipelines we very often just interrupt execution leading to some files (which are crated by our own hooks) hanging around after the run. It seems there's no such hook exposed within Kedro.
i
https://docs.kedro.org/en/stable/kedro.framework.hooks.specs.PipelineSpecs.html#kedro.framework.hooks.specs.PipelineSpecs.on_pipeline_error Not sure about what you want to do exactly, but this runs if there's an uncaught exception, so maybe you could add in error handling for keyboardinterrupt there
p
Thanks! I have this hook present for cleaning up these extra files, and it does kick-off when there is an exception within the pipeline code itself, but unfortunately it doesn't run on manual KeyboardInterrupt 😞
a
Unfortunately there's no hook currently triggered by KeyboardInterrupt, Iñigo's suggestion is probably best here - you could catch KeyboardInterrupts within your pipeline itself, and then throw an exception to trigger the
on_pipeline_error
hook
p
Ah in that sense, thanks for the tip, will have a look 🙂
👍 1