##// END OF EJS Templates
Don't actually change kernel constructor signature
Jessica B. Hamrick -
Show More
@@ -20,13 +20,12 b' define(['
20 * @param {string} kernel_service_url - the URL to access the kernel REST api
20 * @param {string} kernel_service_url - the URL to access the kernel REST api
21 * @param {string} ws_url - the websockets URL
21 * @param {string} ws_url - the websockets URL
22 * @param {Notebook} notebook - notebook object
22 * @param {Notebook} notebook - notebook object
23 * @param {string} id - the kernel id
24 * @param {string} name - the kernel type (e.g. python3)
23 * @param {string} name - the kernel type (e.g. python3)
25 */
24 */
26 var Kernel = function (kernel_service_url, ws_url, notebook, id, name) {
25 var Kernel = function (kernel_service_url, ws_url, notebook, name) {
27 this.events = notebook.events;
26 this.events = notebook.events;
28
27
29 this.id = id;
28 this.id = null;
30 this.name = name;
29 this.name = name;
31
30
32 this.channels = {
31 this.channels = {
@@ -36,7 +35,7 b' define(['
36 };
35 };
37
36
38 this.kernel_service_url = kernel_service_url;
37 this.kernel_service_url = kernel_service_url;
39 this.kernel_url = utils.url_join_encode(this.kernel_service_url, this.id);
38 this.kernel_url = null;
40 this.ws_url = ws_url || IPython.utils.get_body_data("wsUrl");
39 this.ws_url = ws_url || IPython.utils.get_body_data("wsUrl");
41 if (!this.ws_url) {
40 if (!this.ws_url) {
42 // trailing 's' in https will become wss for secure web sockets
41 // trailing 's' in https will become wss for secure web sockets
@@ -153,9 +152,7 b' define(['
153
152
154 var that = this;
153 var that = this;
155 var on_success = function (data, status, xhr) {
154 var on_success = function (data, status, xhr) {
156 that.id = data.id;
155 that._kernel_started(data);
157 that.kernel_url = utils.url_join_encode(that.kernel_service_url, that.id);
158 that._kernel_started();
159 if (success) {
156 if (success) {
160 success(data, status, xhr);
157 success(data, status, xhr);
161 }
158 }
@@ -256,7 +253,7 b' define(['
256
253
257 var that = this;
254 var that = this;
258 var on_success = function (data, status, xhr) {
255 var on_success = function (data, status, xhr) {
259 that._kernel_started();
256 that._kernel_started(data);
260 if (success) {
257 if (success) {
261 success(data, status, xhr);
258 success(data, status, xhr);
262 }
259 }
@@ -332,8 +329,12 b' define(['
332 * then actually connecting to the kernel.
329 * then actually connecting to the kernel.
333 *
330 *
334 * @function _kernel_started
331 * @function _kernel_started
332 * @param {Object} data - information about the kernel including id
335 */
333 */
336 Kernel.prototype._kernel_started = function () {
334 Kernel.prototype._kernel_started = function (data) {
335 this.id = data.id;
336 this.kernel_url = utils.url_join_encode(this.kernel_service_url, this.id);
337
337 console.log("Kernel started: ", this.id);
338 console.log("Kernel started: ", this.id);
338 this.events.trigger('status_started.Kernel', {kernel: this});
339 this.events.trigger('status_started.Kernel', {kernel: this});
339 this.start_channels();
340 this.start_channels();
@@ -85,10 +85,8 b' define(['
85 var that = this;
85 var that = this;
86 var on_success = function (data, status, xhr) {
86 var on_success = function (data, status, xhr) {
87 var kernel_service_url = utils.url_path_join(that.base_url, "api/kernels");
87 var kernel_service_url = utils.url_path_join(that.base_url, "api/kernels");
88 that.kernel = new kernel.Kernel(
88 that.kernel = new kernel.Kernel(kernel_service_url, that.ws_url, that.notebook, that.kernel_model.name);
89 kernel_service_url, that.ws_url, that.notebook,
89 that.kernel._kernel_started(data.kernel);
90 that.kernel_model.id, that.kernel_model.name);
91 that.kernel._kernel_started();
92 if (success) {
90 if (success) {
93 success(data, status, xhr);
91 success(data, status, xhr);
94 }
92 }
General Comments 0
You need to be logged in to leave comments. Login now