jupyter-js-services
Advanced tools
Comparing version 0.6.3 to 0.6.4
@@ -366,17 +366,4 @@ // Copyright (c) Jupyter Development Team. | ||
} | ||
var options = utils.copy(this._options); | ||
options.ajaxSettings = this.ajaxSettings; | ||
options.kernelName = name; | ||
options.notebookPath = this.notebookPath; | ||
return this.delete().then(function () { | ||
return Private.startSession(options); | ||
}).then(function (sessionId) { | ||
return Private.createKernel(sessionId, options); | ||
}).then(function (kernel) { | ||
kernel.statusChanged.connect(_this.onKernelStatus, _this); | ||
kernel.unhandledMessage.connect(_this.onUnhandledMessage, _this); | ||
_this._kernel = kernel; | ||
_this.kernelChanged.emit(kernel); | ||
return kernel; | ||
}); | ||
// Attempt to shutdown the kernel, but change the kernel either way. | ||
return this.kernel.shutdown().then(function () { return _this._changeKernel(name); }, function () { return _this._changeKernel(name); }); | ||
}; | ||
@@ -397,15 +384,2 @@ /** | ||
} | ||
return this.delete().then(function () { | ||
_this._options = null; | ||
_this.sessionDied.emit(void 0); | ||
}); | ||
}; | ||
/** | ||
* Shut down the existing session. | ||
* | ||
* #### Notes | ||
* Uses the [Jupyter Notebook API](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/jupyter-js-services/master/rest_api.yaml#!/sessions), and validates the response. | ||
*/ | ||
NotebookSession.prototype.delete = function () { | ||
var _this = this; | ||
var ajaxSettings = this.ajaxSettings; | ||
@@ -421,2 +395,3 @@ ajaxSettings.method = 'DELETE'; | ||
_this._kernel = null; | ||
_this.sessionDied.emit(void 0); | ||
}, function (rejected) { | ||
@@ -441,2 +416,22 @@ if (rejected.xhr.status === 410) { | ||
}; | ||
/** | ||
* Change the kernel. | ||
*/ | ||
NotebookSession.prototype._changeKernel = function (name) { | ||
var _this = this; | ||
var options = utils.copy(this._options); | ||
options.ajaxSettings = this.ajaxSettings; | ||
options.kernelName = name; | ||
options.notebookPath = this.notebookPath; | ||
this._kernel.dispose(); | ||
return Private.startSession(options).then(function (sessionId) { | ||
return Private.createKernel(sessionId, options); | ||
}).then(function (kernel) { | ||
kernel.statusChanged.connect(_this.onKernelStatus, _this); | ||
kernel.unhandledMessage.connect(_this.onUnhandledMessage, _this); | ||
_this._kernel = kernel; | ||
_this.kernelChanged.emit(kernel); | ||
return kernel; | ||
}); | ||
}; | ||
return NotebookSession; | ||
@@ -443,0 +438,0 @@ })(); |
@@ -32,3 +32,4 @@ // Copyright (c) Jupyter Development Team. | ||
comm_msg: { comm_id: 'string', data: 'any' }, | ||
comm_close: { comm_id: 'string' } | ||
comm_close: { comm_id: 'string' }, | ||
shutdown_reply: { restart: 'boolean' } // Emitted by the IPython kernel. | ||
}; | ||
@@ -35,0 +36,0 @@ /** |
{ | ||
"name": "jupyter-js-services", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Client APIs for the Jupyter services REST APIs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166643
4695