# questions

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ñigo Hidalgo

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

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 😞

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

Piotr Grabowski

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