Skip to content

Commit 42227e9

Browse files
authored
Merge pull request jupyter#5593 from levinxo/master
kill notebook its self when server cull idle kernel (new fix)
2 parents 7978c0f + edc261c commit 42227e9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

notebook/static/services/kernels/kernel.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ define([
141141
this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
142142
this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
143143
this.register_iopub_handler('execute_input', $.proxy(this._handle_input_message, this));
144+
this.register_iopub_handler('shutdown_reply', $.proxy(this._handle_shutdown_message, this));
144145

145146
for (var i=0; i < output_msg_types.length; i++) {
146147
this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
@@ -1212,6 +1213,19 @@ define([
12121213
}
12131214
};
12141215

1216+
1217+
/**
1218+
* Handle a kernel shutdown message
1219+
* @function _handle_shutdown_message
1220+
*/
1221+
Kernel.prototype._handle_shutdown_message = function (msg) {
1222+
if (!msg.content.restart) {
1223+
this.events.trigger('kernel_dead.Kernel', {kernel: this});
1224+
this._kernel_dead();
1225+
}
1226+
}
1227+
1228+
12151229
/**
12161230
* Dispatch IOPub messages to respective handlers. Each message
12171231
* type should have a handler.

0 commit comments

Comments
 (0)