"Run all" doesn't work when external resources are requested by a cell
Sometimes a notebook cell execution result may end up adding an element (such as a <script>) to the DOM in order to load an external resource. Bokeh is one example of this as it wants to load some JS files from a CDN.
Subsequent notebook cells may depend on these resources being loaded, so "run all" doesn't work. Sometimes workarounds can be recommended, such as forcing "inline" mode for Bokeh so that the JS is sent in a Websocket message.
One solution was proposed in https://github.com/jupyter-incubator/dashboards_server/issues/108#issuecomment-193839940 :
@jhpedemonte: So here's my new proposal: we execute all code cells in a loop, then wait for result to come back and pass that to
jupyter-js-output-areato handle. The latter is what adds HTML/JS to the DOM. When handling results, we can add a check to see if any<script>were added to the DOM. If so, we add onLoad handlers and queue up any remaining results until those scripts have loaded.
I'm assuming, for Bokeh at least, the behavior is the same in the notebook server when the user does a Run All, yes?
I suggest not tackling this just yet. I'd like to see how many other libraries have this problem. If they haven't provided a setting like Bokeh's "inline", then they don't technically work properly in the notebook server either. I don't think we should invent execution flows here. (I'd rather see the notebook execution model address this async problem, which I think @lbustelo has mentioned in the past.)
I'm assuming, for Bokeh at least, the behavior is the same in the notebook server when the user does a Run All, yes?
yes
I'd like to see how many other libraries have this problem.
I don't think we should invent execution flows here.
Agreed. I intended this to be an investigation/experiment. Perhaps a component of that is surveying which technologies have this problem in the notebook to help evaluate the scope of the issue.
Sure. I'm saying let's do it as a background task instead of going out and actively finding things that break. Plenty of other things we gotta get working in the meantime.
Ref https://github.com/jupyter/notebook/issues/839