##// END OF EJS Templates
Update JS for kernels and sessions APIs
Thomas Kluyver -
Show More
@@ -1495,7 +1495,12 b' define(['
1495 base_url: this.base_url,
1495 base_url: this.base_url,
1496 notebook_path: this.notebook_path,
1496 notebook_path: this.notebook_path,
1497 notebook_name: this.notebook_name,
1497 notebook_name: this.notebook_name,
1498 // For now, create all sessions with the 'python' kernel, which is the
1499 // default. Later, the user will be able to select kernels. This is
1500 // overridden if KernelManager.kernel_cmd is specified for the server.
1501 kernel_name: 'python'
1498 notebook: this});
1502 notebook: this});
1503
1499 this.session.start($.proxy(this._session_started, this));
1504 this.session.start($.proxy(this._session_started, this));
1500 };
1505 };
1501
1506
@@ -15,13 +15,14 b' define(['
15 * A Kernel Class to communicate with the Python kernel
15 * A Kernel Class to communicate with the Python kernel
16 * @Class Kernel
16 * @Class Kernel
17 */
17 */
18 var Kernel = function (kernel_service_url, notebook) {
18 var Kernel = function (kernel_service_url, notebook, name) {
19 this.events = notebook.events;
19 this.events = notebook.events;
20 this.kernel_id = null;
20 this.kernel_id = null;
21 this.shell_channel = null;
21 this.shell_channel = null;
22 this.iopub_channel = null;
22 this.iopub_channel = null;
23 this.stdin_channel = null;
23 this.stdin_channel = null;
24 this.kernel_service_url = kernel_service_url;
24 this.kernel_service_url = kernel_service_url;
25 this.name = name;
25 this.running = false;
26 this.running = false;
26 this.username = "username";
27 this.username = "username";
27 this.session_id = utils.uuid();
28 this.session_id = utils.uuid();
@@ -15,6 +15,7 b' define(['
15 this.notebook = options.notebook;
15 this.notebook = options.notebook;
16 this.name = options.notebook_name;
16 this.name = options.notebook_name;
17 this.path = options.notebook_path;
17 this.path = options.notebook_path;
18 this.kernel_name = options.kernel_name;
18 this.base_url = options.base_url;
19 this.base_url = options.base_url;
19 };
20 };
20
21
@@ -24,6 +25,9 b' define(['
24 notebook : {
25 notebook : {
25 name : this.name,
26 name : this.name,
26 path : this.path
27 path : this.path
28 },
29 kernel : {
30 name : this.kernel_name
27 }
31 }
28 };
32 };
29 var settings = {
33 var settings = {
@@ -87,7 +91,7 b' define(['
87 Session.prototype._handle_start_success = function (data, status, xhr) {
91 Session.prototype._handle_start_success = function (data, status, xhr) {
88 this.id = data.id;
92 this.id = data.id;
89 var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
93 var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
90 this.kernel = new kernel.Kernel(kernel_service_url, this.notebook);
94 this.kernel = new kernel.Kernel(kernel_service_url, this.notebook, this.kernel_name);
91 this.kernel._kernel_started(data.kernel);
95 this.kernel._kernel_started(data.kernel);
92 };
96 };
93
97
@@ -80,7 +80,7 b' casper.notebook_test(function () {'
80 });
80 });
81 return return_this_thing;
81 return return_this_thing;
82 }, {nbname:nbname});
82 }, {nbname:nbname});
83 this.test.assertEquals(notebook_url == null, false, "Escaped URL in notebook list");
83 this.test.assertNotEquals(notebook_url, null, "Escaped URL in notebook list");
84 // open the notebook
84 // open the notebook
85 this.open(notebook_url);
85 this.open(notebook_url);
86 });
86 });
General Comments 0
You need to be logged in to leave comments. Login now