Use a scheduling list for running marked cells#946
Use a scheduling list for running marked cells#946juhasch merged 14 commits intoipython-contrib:masterfrom
Conversation
|
Awesome feature! Really helpful |
jcb91
left a comment
There was a problem hiding this comment.
Nice idea, although it does lead to potential problems when multiple frontends have different execution queues 😨
| if (cell.metadata.run_control != undefined) { | ||
| if (cell.metadata.run_control.marked == true ) { | ||
| var g=cell.code_mirror.getGutterElement(); | ||
| $(g).css({"background-color": "#0f0"}); |
There was a problem hiding this comment.
To reset, this should just set an empty string, I think
There was a problem hiding this comment.
Wait, I think maybe it's not a reset, and the comment needs altering?
| }; | ||
|
|
||
| // updates default params with any specified in the provided config data | ||
| var update_params = function (config_data) { |
There was a problem hiding this comment.
this function never actually gets called. Also, given parameters are all runtools.x, it would make more sense to just do
$.extend(true, params, config_data.runtools);| "use strict"; | ||
|
|
||
| var base_url = utils.get_body_data("baseUrl"); | ||
| var config = new configmod.ConfigSection('notebook', {base_url: base_url}); |
There was a problem hiding this comment.
it's better I think to use Jupyter.notebook.config, which is loaded by the page already, and means we don't have to make a second request to the server (or load utils/config modules)
| } | ||
| }; | ||
|
|
||
| config.loaded.then(function() { |
There was a problem hiding this comment.
if using Jupyter.notebook.config, as suggested above, loaded has already resolved, so this would get executed immediately. Instead, this should be changed into a function (say initialize), then in load_ipython_extension you can call Jupyter.notebook.config.loaded.then(initialize);
| */ | ||
| function set_cell_state(cell, state) { | ||
| var icon = ""; | ||
| if (state === 'locked') |
There was a problem hiding this comment.
should this also have aria-hidden="true"?
| events.one('notebook_loaded.Notebook', initGutter); | ||
| } | ||
| }); | ||
| config.load() |
There was a problem hiding this comment.
this can be replaced with Jupyter.notebook.config.loaded.then(initialize); as discussed above
| Icon: icon.png | ||
| Main: main.js | ||
| Compatibility: 4.x | ||
| Compatibility: 5.x |
| - name: runtools.marked_color | ||
| description: | | ||
| Color for marking a codecell | ||
| default: '#0f0' |
There was a problem hiding this comment.
I have a feeling that the configurator fails to load correctly 3-character colour codes, so it's probably best to use the full 6-char code here
| - name: runtools.scheduled_color | ||
| description: | | ||
| Color when a codecell is scheduled to be rund | ||
| default: '#00f' |
| if (val) { | ||
| cm.state.cellState = new State(parseOptions(val)); | ||
| updateInViewport(cm); | ||
| cm.on("gutterClick", onGutterClick); |
There was a problem hiding this comment.
are these defined in this scope? How does this file get loaded?
There was a problem hiding this comment.
It is loaded at load_extension time now.
|
@jcb91: Thanks for the review The reason I did not continue to work on this (apart from restricted time) is, that I am not sure what the right behavior should be. Or if there is the a 'right' behavior at all. What happens if you reshuffle the cells during execution? Should they be executed in the original sequence or should the cells that are now further up be executed first? |
|
OK, I have updated the extension, incorporated @jcb91's comments and updated the documentation. |

Run each cell individually after the previous one has finished. This allows stopping execution of a following cell:

Note: Only works with Notebook >= 5.0