##// END OF EJS Templates
Update directview.ipynb & allowing no-callbacks in kernel.execute.
Brian Granger -
Show More
@@ -1,385 +1,386 b''
1 //----------------------------------------------------------------------------
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2011 The IPython Development Team
2 // Copyright (C) 2008-2011 The IPython Development Team
3 //
3 //
4 // Distributed under the terms of the BSD License. The full license is in
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
6 //----------------------------------------------------------------------------
7
7
8 //============================================================================
8 //============================================================================
9 // Kernel
9 // Kernel
10 //============================================================================
10 //============================================================================
11
11
12 var IPython = (function (IPython) {
12 var IPython = (function (IPython) {
13
13
14 var utils = IPython.utils;
14 var utils = IPython.utils;
15
15
16 // Initialization and connection.
16 // Initialization and connection.
17
17
18 var Kernel = function (base_url) {
18 var Kernel = function (base_url) {
19 this.kernel_id = null;
19 this.kernel_id = null;
20 this.shell_channel = null;
20 this.shell_channel = null;
21 this.iopub_channel = null;
21 this.iopub_channel = null;
22 this.base_url = base_url;
22 this.base_url = base_url;
23 this.running = false;
23 this.running = false;
24 this.username = "username";
24 this.username = "username";
25 this.session_id = utils.uuid();
25 this.session_id = utils.uuid();
26 this._msg_callbacks = {};
26 this._msg_callbacks = {};
27
27
28 if (typeof(WebSocket) !== 'undefined') {
28 if (typeof(WebSocket) !== 'undefined') {
29 this.WebSocket = WebSocket;
29 this.WebSocket = WebSocket;
30 } else if (typeof(MozWebSocket) !== 'undefined') {
30 } else if (typeof(MozWebSocket) !== 'undefined') {
31 this.WebSocket = MozWebSocket;
31 this.WebSocket = MozWebSocket;
32 } else {
32 } else {
33 alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox β‰₯ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
33 alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox β‰₯ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
34 };
34 };
35 };
35 };
36
36
37
37
38 Kernel.prototype._get_msg = function (msg_type, content) {
38 Kernel.prototype._get_msg = function (msg_type, content) {
39 var msg = {
39 var msg = {
40 header : {
40 header : {
41 msg_id : utils.uuid(),
41 msg_id : utils.uuid(),
42 username : this.username,
42 username : this.username,
43 session : this.session_id,
43 session : this.session_id,
44 msg_type : msg_type
44 msg_type : msg_type
45 },
45 },
46 content : content,
46 content : content,
47 parent_header : {}
47 parent_header : {}
48 };
48 };
49 return msg;
49 return msg;
50 };
50 };
51
51
52 Kernel.prototype.start = function (notebook_id) {
52 Kernel.prototype.start = function (notebook_id) {
53 var that = this;
53 var that = this;
54 if (!this.running) {
54 if (!this.running) {
55 var qs = $.param({notebook:notebook_id});
55 var qs = $.param({notebook:notebook_id});
56 var url = this.base_url + '?' + qs;
56 var url = this.base_url + '?' + qs;
57 $.post(url,
57 $.post(url,
58 $.proxy(that._kernel_started,that),
58 $.proxy(that._kernel_started,that),
59 'json'
59 'json'
60 );
60 );
61 };
61 };
62 };
62 };
63
63
64
64
65 Kernel.prototype.restart = function () {
65 Kernel.prototype.restart = function () {
66 $([IPython.events]).trigger('status_restarting.Kernel');
66 $([IPython.events]).trigger('status_restarting.Kernel');
67 var that = this;
67 var that = this;
68 if (this.running) {
68 if (this.running) {
69 this.stop_channels();
69 this.stop_channels();
70 var url = this.kernel_url + "/restart";
70 var url = this.kernel_url + "/restart";
71 $.post(url,
71 $.post(url,
72 $.proxy(that._kernel_started, that),
72 $.proxy(that._kernel_started, that),
73 'json'
73 'json'
74 );
74 );
75 };
75 };
76 };
76 };
77
77
78
78
79 Kernel.prototype._kernel_started = function (json) {
79 Kernel.prototype._kernel_started = function (json) {
80 console.log("Kernel started: ", json.kernel_id);
80 console.log("Kernel started: ", json.kernel_id);
81 this.running = true;
81 this.running = true;
82 this.kernel_id = json.kernel_id;
82 this.kernel_id = json.kernel_id;
83 this.ws_url = json.ws_url;
83 this.ws_url = json.ws_url;
84 this.kernel_url = this.base_url + "/" + this.kernel_id;
84 this.kernel_url = this.base_url + "/" + this.kernel_id;
85 this.start_channels();
85 this.start_channels();
86 this.shell_channel.onmessage = $.proxy(this._handle_shell_reply,this);
86 this.shell_channel.onmessage = $.proxy(this._handle_shell_reply,this);
87 this.iopub_channel.onmessage = $.proxy(this._handle_iopub_reply,this);
87 this.iopub_channel.onmessage = $.proxy(this._handle_iopub_reply,this);
88 };
88 };
89
89
90
90
91 Kernel.prototype._websocket_closed = function(ws_url, early){
91 Kernel.prototype._websocket_closed = function(ws_url, early){
92 var msg;
92 var msg;
93 var parent_item = $('body');
93 var parent_item = $('body');
94 if (early) {
94 if (early) {
95 msg = "Websocket connection to " + ws_url + " could not be established." +
95 msg = "Websocket connection to " + ws_url + " could not be established." +
96 " You will NOT be able to run code." +
96 " You will NOT be able to run code." +
97 " Your browser may not be compatible with the websocket version in the server," +
97 " Your browser may not be compatible with the websocket version in the server," +
98 " or if the url does not look right, there could be an error in the" +
98 " or if the url does not look right, there could be an error in the" +
99 " server's configuration.";
99 " server's configuration.";
100 } else {
100 } else {
101 msg = "Websocket connection closed unexpectedly." +
101 msg = "Websocket connection closed unexpectedly." +
102 " The kernel will no longer be responsive.";
102 " The kernel will no longer be responsive.";
103 }
103 }
104 var dialog = $('<div/>');
104 var dialog = $('<div/>');
105 dialog.html(msg);
105 dialog.html(msg);
106 parent_item.append(dialog);
106 parent_item.append(dialog);
107 dialog.dialog({
107 dialog.dialog({
108 resizable: false,
108 resizable: false,
109 modal: true,
109 modal: true,
110 title: "Websocket closed",
110 title: "Websocket closed",
111 closeText: "",
111 closeText: "",
112 close: function(event, ui) {$(this).dialog('destroy').remove();},
112 close: function(event, ui) {$(this).dialog('destroy').remove();},
113 buttons : {
113 buttons : {
114 "OK": function () {
114 "OK": function () {
115 $(this).dialog('close');
115 $(this).dialog('close');
116 }
116 }
117 }
117 }
118 });
118 });
119
119
120 };
120 };
121
121
122 Kernel.prototype.start_channels = function () {
122 Kernel.prototype.start_channels = function () {
123 var that = this;
123 var that = this;
124 this.stop_channels();
124 this.stop_channels();
125 var ws_url = this.ws_url + this.kernel_url;
125 var ws_url = this.ws_url + this.kernel_url;
126 console.log("Starting WS:", ws_url);
126 console.log("Starting WS:", ws_url);
127 this.shell_channel = new this.WebSocket(ws_url + "/shell");
127 this.shell_channel = new this.WebSocket(ws_url + "/shell");
128 this.iopub_channel = new this.WebSocket(ws_url + "/iopub");
128 this.iopub_channel = new this.WebSocket(ws_url + "/iopub");
129 send_cookie = function(){
129 send_cookie = function(){
130 this.send(document.cookie);
130 this.send(document.cookie);
131 };
131 };
132 var already_called_onclose = false; // only alert once
132 var already_called_onclose = false; // only alert once
133 ws_closed_early = function(evt){
133 ws_closed_early = function(evt){
134 if (already_called_onclose){
134 if (already_called_onclose){
135 return;
135 return;
136 }
136 }
137 already_called_onclose = true;
137 already_called_onclose = true;
138 if ( ! evt.wasClean ){
138 if ( ! evt.wasClean ){
139 that._websocket_closed(ws_url, true);
139 that._websocket_closed(ws_url, true);
140 }
140 }
141 };
141 };
142 ws_closed_late = function(evt){
142 ws_closed_late = function(evt){
143 if (already_called_onclose){
143 if (already_called_onclose){
144 return;
144 return;
145 }
145 }
146 already_called_onclose = true;
146 already_called_onclose = true;
147 if ( ! evt.wasClean ){
147 if ( ! evt.wasClean ){
148 that._websocket_closed(ws_url, false);
148 that._websocket_closed(ws_url, false);
149 }
149 }
150 };
150 };
151 this.shell_channel.onopen = send_cookie;
151 this.shell_channel.onopen = send_cookie;
152 this.shell_channel.onclose = ws_closed_early;
152 this.shell_channel.onclose = ws_closed_early;
153 this.iopub_channel.onopen = send_cookie;
153 this.iopub_channel.onopen = send_cookie;
154 this.iopub_channel.onclose = ws_closed_early;
154 this.iopub_channel.onclose = ws_closed_early;
155 // switch from early-close to late-close message after 1s
155 // switch from early-close to late-close message after 1s
156 setTimeout(function(){
156 setTimeout(function(){
157 that.shell_channel.onclose = ws_closed_late;
157 that.shell_channel.onclose = ws_closed_late;
158 that.iopub_channel.onclose = ws_closed_late;
158 that.iopub_channel.onclose = ws_closed_late;
159 }, 1000);
159 }, 1000);
160 };
160 };
161
161
162
162
163 Kernel.prototype.stop_channels = function () {
163 Kernel.prototype.stop_channels = function () {
164 if (this.shell_channel !== null) {
164 if (this.shell_channel !== null) {
165 this.shell_channel.onclose = function (evt) {};
165 this.shell_channel.onclose = function (evt) {};
166 this.shell_channel.close();
166 this.shell_channel.close();
167 this.shell_channel = null;
167 this.shell_channel = null;
168 };
168 };
169 if (this.iopub_channel !== null) {
169 if (this.iopub_channel !== null) {
170 this.iopub_channel.onclose = function (evt) {};
170 this.iopub_channel.onclose = function (evt) {};
171 this.iopub_channel.close();
171 this.iopub_channel.close();
172 this.iopub_channel = null;
172 this.iopub_channel = null;
173 };
173 };
174 };
174 };
175
175
176 // Main public methods.
176 // Main public methods.
177
177
178 Kernel.prototype.object_info_request = function (objname, callbacks) {
178 Kernel.prototype.object_info_request = function (objname, callbacks) {
179 // When calling this method pass a callbacks structure of the form:
179 // When calling this method pass a callbacks structure of the form:
180 //
180 //
181 // callbacks = {
181 // callbacks = {
182 // 'object_info_reply': object_into_reply_callback
182 // 'object_info_reply': object_into_reply_callback
183 // }
183 // }
184 //
184 //
185 // The object_info_reply_callback will be passed the content object of the
185 // The object_info_reply_callback will be passed the content object of the
186 // object_into_reply message documented here:
186 // object_into_reply message documented here:
187 //
187 //
188 // http://ipython.org/ipython-doc/dev/development/messaging.html#object-information
188 // http://ipython.org/ipython-doc/dev/development/messaging.html#object-information
189 if(typeof(objname)!=null && objname!=null)
189 if(typeof(objname)!=null && objname!=null)
190 {
190 {
191 var content = {
191 var content = {
192 oname : objname.toString(),
192 oname : objname.toString(),
193 };
193 };
194 var msg = this._get_msg("object_info_request", content);
194 var msg = this._get_msg("object_info_request", content);
195 this.shell_channel.send(JSON.stringify(msg));
195 this.shell_channel.send(JSON.stringify(msg));
196 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
196 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
197 return msg.header.msg_id;
197 return msg.header.msg_id;
198 }
198 }
199 return;
199 return;
200 }
200 }
201
201
202 Kernel.prototype.execute = function (code, callbacks, options) {
202 Kernel.prototype.execute = function (code, callbacks, options) {
203 // The options object should contain the options for the execute call. Its default
203 // The options object should contain the options for the execute call. Its default
204 // values are:
204 // values are:
205 //
205 //
206 // options = {
206 // options = {
207 // silent : true,
207 // silent : true,
208 // user_variables : [],
208 // user_variables : [],
209 // user_expressions : {},
209 // user_expressions : {},
210 // allow_stdin : false
210 // allow_stdin : false
211 // }
211 // }
212 //
212 //
213 // When calling this method pass a callbacks structure of the form:
213 // When calling this method pass a callbacks structure of the form:
214 //
214 //
215 // callbacks = {
215 // callbacks = {
216 // 'execute_reply': execute_reply_callback,
216 // 'execute_reply': execute_reply_callback,
217 // 'output': output_callback,
217 // 'output': output_callback,
218 // 'clear_output': clear_output_callback,
218 // 'clear_output': clear_output_callback,
219 // 'cell': cell
219 // 'cell': cell
220 // }
220 // }
221 //
221 //
222 // The execute_reply_callback will be passed the content object of the execute_reply
222 // The execute_reply_callback will be passed the content object of the execute_reply
223 // message documented here:
223 // message documented here:
224 //
224 //
225 // http://ipython.org/ipython-doc/dev/development/messaging.html#execute
225 // http://ipython.org/ipython-doc/dev/development/messaging.html#execute
226 //
226 //
227 // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr')
227 // The output_callback will be passed msg_type ('stream','display_data','pyout','pyerr')
228 // of the output and the content object of the PUB/SUB channel that contains the
228 // of the output and the content object of the PUB/SUB channel that contains the
229 // output:
229 // output:
230 //
230 //
231 // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket
231 // http://ipython.org/ipython-doc/dev/development/messaging.html#messages-on-the-pub-sub-socket
232 //
232 //
233 // The clear_output_callback will be passed a content object that contains
233 // The clear_output_callback will be passed a content object that contains
234 // stdout, stderr and other fields that are booleans.
234 // stdout, stderr and other fields that are booleans.
235 //
235 //
236 // The cell value will contain the a cell object that the notebook can use for the
236 // The cell value will contain the a cell object that the notebook can use for the
237 // set_next_input payload.
237 // set_next_input payload.
238
238
239 var content = {
239 var content = {
240 code : code,
240 code : code,
241 silent : true,
241 silent : true,
242 user_variables : [],
242 user_variables : [],
243 user_expressions : {},
243 user_expressions : {},
244 allow_stdin : false
244 allow_stdin : false
245 };
245 };
246 $.extend(true, content, options)
246 $.extend(true, content, options)
247 var msg = this._get_msg("execute_request", content);
247 var msg = this._get_msg("execute_request", content);
248 this.shell_channel.send(JSON.stringify(msg));
248 this.shell_channel.send(JSON.stringify(msg));
249 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
249 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
250 return msg.header.msg_id;
250 return msg.header.msg_id;
251 };
251 };
252
252
253
253
254 Kernel.prototype.complete = function (line, cursor_pos, callbacks) {
254 Kernel.prototype.complete = function (line, cursor_pos, callbacks) {
255 // When calling this method pass a callbacks structure of the form:
255 // When calling this method pass a callbacks structure of the form:
256 //
256 //
257 // callbacks = {
257 // callbacks = {
258 // 'complete_reply': complete_reply_callback
258 // 'complete_reply': complete_reply_callback
259 // }
259 // }
260 //
260 //
261 // The complete_reply_callback will be passed the content object of the
261 // The complete_reply_callback will be passed the content object of the
262 // complete_reply message documented here:
262 // complete_reply message documented here:
263 //
263 //
264 // http://ipython.org/ipython-doc/dev/development/messaging.html#complete
264 // http://ipython.org/ipython-doc/dev/development/messaging.html#complete
265 callbacks = callbacks || {};
265 var content = {
266 var content = {
266 text : '',
267 text : '',
267 line : line,
268 line : line,
268 cursor_pos : cursor_pos
269 cursor_pos : cursor_pos
269 };
270 };
270 var msg = this._get_msg("complete_request", content);
271 var msg = this._get_msg("complete_request", content);
271 this.shell_channel.send(JSON.stringify(msg));
272 this.shell_channel.send(JSON.stringify(msg));
272 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
273 this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
273 return msg.header.msg_id;
274 return msg.header.msg_id;
274 };
275 };
275
276
276
277
277 Kernel.prototype.interrupt = function () {
278 Kernel.prototype.interrupt = function () {
278 if (this.running) {
279 if (this.running) {
279 $([IPython.events]).trigger('status_interrupting.Kernel');
280 $([IPython.events]).trigger('status_interrupting.Kernel');
280 $.post(this.kernel_url + "/interrupt");
281 $.post(this.kernel_url + "/interrupt");
281 };
282 };
282 };
283 };
283
284
284
285
285 Kernel.prototype.kill = function () {
286 Kernel.prototype.kill = function () {
286 if (this.running) {
287 if (this.running) {
287 this.running = false;
288 this.running = false;
288 var settings = {
289 var settings = {
289 cache : false,
290 cache : false,
290 type : "DELETE"
291 type : "DELETE"
291 };
292 };
292 $.ajax(this.kernel_url, settings);
293 $.ajax(this.kernel_url, settings);
293 };
294 };
294 };
295 };
295
296
296
297
297 // Reply handlers.
298 // Reply handlers.
298
299
299 Kernel.prototype.get_callbacks_for_msg = function (msg_id) {
300 Kernel.prototype.get_callbacks_for_msg = function (msg_id) {
300 var callbacks = this._msg_callbacks[msg_id];
301 var callbacks = this._msg_callbacks[msg_id];
301 return callbacks;
302 return callbacks;
302 };
303 };
303
304
304
305
305 Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks) {
306 Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks) {
306 this._msg_callbacks[msg_id] = callbacks;
307 this._msg_callbacks[msg_id] = callbacks || {};
307 }
308 }
308
309
309
310
310 Kernel.prototype._handle_shell_reply = function (e) {
311 Kernel.prototype._handle_shell_reply = function (e) {
311 reply = $.parseJSON(e.data);
312 reply = $.parseJSON(e.data);
312 var header = reply.header;
313 var header = reply.header;
313 var content = reply.content;
314 var content = reply.content;
314 var msg_type = header.msg_type;
315 var msg_type = header.msg_type;
315 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
316 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
316 if (callbacks !== undefined) {
317 if (callbacks !== undefined) {
317 var cb = callbacks[msg_type];
318 var cb = callbacks[msg_type];
318 if (cb !== undefined) {
319 if (cb !== undefined) {
319 cb(content);
320 cb(content);
320 }
321 }
321 };
322 };
322
323
323 if (content.payload !== undefined) {
324 if (content.payload !== undefined && callbacks.cell !== undefined) {
324 var payload = content.payload || [];
325 var payload = content.payload || [];
325 this._handle_payload(callbacks.cell, payload);
326 this._handle_payload(callbacks.cell, payload);
326 }
327 }
327 };
328 };
328
329
329
330
330 Kernel.prototype._handle_payload = function (cell, payload) {
331 Kernel.prototype._handle_payload = function (cell, payload) {
331 var l = payload.length;
332 var l = payload.length;
332 // Payloads are handled by triggering events because we don't want the Kernel
333 // Payloads are handled by triggering events because we don't want the Kernel
333 // to depend on the Notebook or Pager classes.
334 // to depend on the Notebook or Pager classes.
334 for (var i=0; i<l; i++) {
335 for (var i=0; i<l; i++) {
335 if (payload[i].source === 'IPython.zmq.page.page') {
336 if (payload[i].source === 'IPython.zmq.page.page') {
336 var data = {'text':payload[i].text}
337 var data = {'text':payload[i].text}
337 $([IPython.events]).trigger('open_with_text.Pager', data);
338 $([IPython.events]).trigger('open_with_text.Pager', data);
338 } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input' && cell !== undefined) {
339 } else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input' && cell !== undefined) {
339 var data = {'cell': cell, 'text': payload[i].text}
340 var data = {'cell': cell, 'text': payload[i].text}
340 $([IPython.events]).trigger('set_next_input.Notebook', data);
341 $([IPython.events]).trigger('set_next_input.Notebook', data);
341 }
342 }
342 };
343 };
343 };
344 };
344
345
345
346
346 Kernel.prototype._handle_iopub_reply = function (e) {
347 Kernel.prototype._handle_iopub_reply = function (e) {
347 reply = $.parseJSON(e.data);
348 reply = $.parseJSON(e.data);
348 var content = reply.content;
349 var content = reply.content;
349 var msg_type = reply.header.msg_type;
350 var msg_type = reply.header.msg_type;
350 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
351 var callbacks = this.get_callbacks_for_msg(reply.parent_header.msg_id);
351 if (msg_type !== 'status' && callbacks === undefined) {
352 if (msg_type !== 'status' && callbacks === undefined) {
352 // Message not from one of this notebook's cells and there are no
353 // Message not from one of this notebook's cells and there are no
353 // callbacks to handle it.
354 // callbacks to handle it.
354 return;
355 return;
355 }
356 }
356 var output_types = ['stream','display_data','pyout','pyerr'];
357 var output_types = ['stream','display_data','pyout','pyerr'];
357 if (output_types.indexOf(msg_type) >= 0) {
358 if (output_types.indexOf(msg_type) >= 0) {
358 var cb = callbacks['output'];
359 var cb = callbacks['output'];
359 if (cb !== undefined) {
360 if (cb !== undefined) {
360 cb(msg_type, content);
361 cb(msg_type, content);
361 }
362 }
362 } else if (msg_type === 'status') {
363 } else if (msg_type === 'status') {
363 if (content.execution_state === 'busy') {
364 if (content.execution_state === 'busy') {
364 $([IPython.events]).trigger('status_busy.Kernel');
365 $([IPython.events]).trigger('status_busy.Kernel');
365 } else if (content.execution_state === 'idle') {
366 } else if (content.execution_state === 'idle') {
366 $([IPython.events]).trigger('status_idle.Kernel');
367 $([IPython.events]).trigger('status_idle.Kernel');
367 } else if (content.execution_state === 'dead') {
368 } else if (content.execution_state === 'dead') {
368 this.stop_channels();
369 this.stop_channels();
369 $([IPython.events]).trigger('status_dead.Kernel');
370 $([IPython.events]).trigger('status_dead.Kernel');
370 };
371 };
371 } else if (msg_type === 'clear_output') {
372 } else if (msg_type === 'clear_output') {
372 var cb = callbacks['clear_output'];
373 var cb = callbacks['clear_output'];
373 if (cb !== undefined) {
374 if (cb !== undefined) {
374 cb(content);
375 cb(content);
375 }
376 }
376 };
377 };
377 };
378 };
378
379
379
380
380 IPython.Kernel = Kernel;
381 IPython.Kernel = Kernel;
381
382
382 return IPython;
383 return IPython;
383
384
384 }(IPython));
385 }(IPython));
385
386
@@ -1,20 +1,38 b''
1 {
1 {
2 "metadata": {
2 "metadata": {
3 "name": "directview"
3 "name": "directview"
4 },
4 },
5 "nbformat": 3,
5 "nbformat": 3,
6 "worksheets": [
6 "worksheets": [
7 {
7 {
8 "cells": [
8 "cells": [
9 {
9 {
10 "cell_type": "code",
10 "cell_type": "code",
11 "input": [
11 "input": [
12 ""
12 "from directview import interact",
13 "from IPython.parallel import Client"
14 ],
15 "language": "python",
16 "outputs": []
17 },
18 {
19 "cell_type": "code",
20 "input": [
21 "c = Client()",
22 "dv = c[:]"
23 ],
24 "language": "python",
25 "outputs": []
26 },
27 {
28 "cell_type": "code",
29 "input": [
30 "interact(dv)"
13 ],
31 ],
14 "language": "python",
32 "language": "python",
15 "outputs": []
33 "outputs": []
16 }
34 }
17 ]
35 ]
18 }
36 }
19 ]
37 ]
20 } No newline at end of file
38 }
General Comments 0
You need to be logged in to leave comments. Login now