mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
Update JS for kernels and sessions APIs
This commit is contained in:
parent
806432072a
commit
6efbe46b73
@ -1495,7 +1495,12 @@ define([
|
||||
base_url: this.base_url,
|
||||
notebook_path: this.notebook_path,
|
||||
notebook_name: this.notebook_name,
|
||||
// For now, create all sessions with the 'python' kernel, which is the
|
||||
// default. Later, the user will be able to select kernels. This is
|
||||
// overridden if KernelManager.kernel_cmd is specified for the server.
|
||||
kernel_name: 'python'
|
||||
notebook: this});
|
||||
|
||||
this.session.start($.proxy(this._session_started, this));
|
||||
};
|
||||
|
||||
|
@ -15,13 +15,14 @@ define([
|
||||
* A Kernel Class to communicate with the Python kernel
|
||||
* @Class Kernel
|
||||
*/
|
||||
var Kernel = function (kernel_service_url, notebook) {
|
||||
var Kernel = function (kernel_service_url, notebook, name) {
|
||||
this.events = notebook.events;
|
||||
this.kernel_id = null;
|
||||
this.shell_channel = null;
|
||||
this.iopub_channel = null;
|
||||
this.stdin_channel = null;
|
||||
this.kernel_service_url = kernel_service_url;
|
||||
this.name = name;
|
||||
this.running = false;
|
||||
this.username = "username";
|
||||
this.session_id = utils.uuid();
|
||||
|
@ -15,6 +15,7 @@ define([
|
||||
this.notebook = options.notebook;
|
||||
this.name = options.notebook_name;
|
||||
this.path = options.notebook_path;
|
||||
this.kernel_name = options.kernel_name;
|
||||
this.base_url = options.base_url;
|
||||
};
|
||||
|
||||
@ -24,6 +25,9 @@ define([
|
||||
notebook : {
|
||||
name : this.name,
|
||||
path : this.path
|
||||
},
|
||||
kernel : {
|
||||
name : this.kernel_name
|
||||
}
|
||||
};
|
||||
var settings = {
|
||||
@ -87,7 +91,7 @@ define([
|
||||
Session.prototype._handle_start_success = function (data, status, xhr) {
|
||||
this.id = data.id;
|
||||
var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
|
||||
this.kernel = new kernel.Kernel(kernel_service_url, this.notebook);
|
||||
this.kernel = new kernel.Kernel(kernel_service_url, this.notebook, this.kernel_name);
|
||||
this.kernel._kernel_started(data.kernel);
|
||||
};
|
||||
|
||||
|
@ -80,7 +80,7 @@ casper.notebook_test(function () {
|
||||
});
|
||||
return return_this_thing;
|
||||
}, {nbname:nbname});
|
||||
this.test.assertEquals(notebook_url == null, false, "Escaped URL in notebook list");
|
||||
this.test.assertNotEquals(notebook_url, null, "Escaped URL in notebook list");
|
||||
// open the notebook
|
||||
this.open(notebook_url);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user