papermill
papermill copied to clipboard
Pass signals down to kernel
I've got some users that would like to be able to do cleanup within a notebook when it receives a certain signal, using the standard python library's signal package:
def cleanup(signum, frame):
print("cleaning up")
sys.exit(2)
signal.signal(signal.SIGTERM, cleanup)
Right now papermill doesn't appear to pass the message on when it is killed with a SIGTERM.
Use case:
A scheduled notebook kicks off a job on a different service (e.g. genie). When the scheduler kills the execution of my notebook, I want the notebook as it shuts down to kill the job running on the other service.
I think this is a good idea, might need implementation back in nbclient to support it. I'll look a bit deeper into what's needed.
Hey @MSeal @willingc, any idea if this is scoped for the near future?