Colab long-running cell: graceful shutdown on kernel interrupt and idle timeout
Google Colab disconnects idle sessions after roughly 90 minutes, and the only way to stop a running cell is the Stop button (kernel interrupt), which abruptly terminates code with no guaranteed cleanup. I want to handle cancellation gracefully in a long-running training cell. The interrupt raises KeyboardInterrupt in the cell, but I am unsure how to structur