https://kedro.org/ logo
#questions
Title
# questions
p

Piotr Grabowski

02/07/2024, 7:58 AM
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

Iñigo Hidalgo

02/07/2024, 8:45 AM
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

Piotr Grabowski

02/07/2024, 8:46 AM
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

Ahdra Merali

02/07/2024, 11:25 AM
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

Piotr Grabowski

02/07/2024, 12:19 PM
Ah in that sense, thanks for the tip, will have a look 🙂
👍 1