LibreTexts / ckeditor-binder-plugin

A CKeditor plugin that makes adding binder enabled pre tags easy.
GNU General Public License v3.0
4 stars 2 forks source link

Julia session sometimes just freezes #152

Closed pstaabp closed 3 years ago

pstaabp commented 3 years ago

I'm using a lot of Julia code blocks and sometimes in both edit mode and run mode I don't get any response. Sometimes I get an error in the javascript console:

Unhandled Promise Rejection: Error: Canceled future for kernel_info_request message before replies were done
(anonymous function) — default.js:566
asyncFunctionResume
(anonymous function)
promiseReactionJobWithoutPromise
promiseReactionJob
f1.widget.js:55:19676

but not always.

Another feature would be some way of getting additional feedback about what is happening. When Julia starts up, I know it often takes a while to get started (and then after that it's fast). It would be nice to see something visual saying it's actually working. Use jupyter there is at least a little feedback (usually in a status bar on the bottom).

moorepants commented 3 years ago

Can you provide us with some sample Julia code you are trying? Or point us to the libretexts page you are working on?

moorepants commented 3 years ago

The only feedback we currently provide (at all) is the icon in the bottom left of the screen that tells you if the binder backend is loading or loaded. See: image

Other than that, there is no feedback when executing individual cells (in any language). This is similar to a command line REPL, where you'd need to add some print statements or such to see if your code is being executed.

If we want to display feedback for each cell then we'd need to see if a feature like that can be added to https://github.com/executablebooks/thebe.

My recommendation would be to create a notebook on jupyter.libertexts.org, get it all working as you want. Then copy & paste the cells into a libretexts page.

We can try to reproduce the JS error though.

pstaabp commented 3 years ago

Can you provide us with some sample Julia code you are trying? Or point us to the libretexts page you are working on?

I have been working on https://math.libretexts.org/Bookshelves/Scientific_Computing_Simulations_and_Modeling/Book%3A_ScientificComputing(Staab)

and almost all of the pages have Julia codeboxes. I just picked section 4.3 as an example and it's not running right now. I usually open up the javascript console to see if there are any other messages and sometimes I see the one I posted about.

My recommendation would be to create a notebook on jupyter.libertexts.org, get it all working as you want. Then copy & paste the cells into a libretexts page.

I have everything as local jupyter notebooks and then copy/paste.

sandertyu commented 3 years ago

I'm able to replicate the error;

console

We'll have to take a look at this code in barebones Thebe to see where the issue lies. The code cells do take forever to run and I'm not exactly sure what the expected output is.

pstaabp commented 3 years ago

Would you like a jupyter notebooks with the cells? I can make one and attach or add to jupyter.libretexts.org (although it doesn't look like I have an account right now).

sandertyu commented 3 years ago

Everything works fine using an HTML page from the widget-testing repo with default-env 2.3.3 and julia kernel 1.5, which is the same as the ckeditor-binder-plugin that we have deployed.

And here it is in development ckeditor-binder-plugin;

binder-plugin

The type error happens whenever I click reset and run all for some reasons.... I noticed it acting funky on libretexts as well when I use that button. Either way, the code cells run decently fast and without error in the console otherwise.

We can use the code on Libretexts fine to test the code, but thank you.

moorepants commented 3 years ago

So that sounds like the bug is on our end, not thebe's?

sandertyu commented 3 years ago

So that sounds like the bug is on our end, not thebe's?

I saw similar javascript error when I told binder to use the wrong Julia kernel, but my local setup should be identical to what is deployed. I'm going to look at query.libretexts.org and dev.libretexts.org as well.

sandertyu commented 3 years ago

I'm able to run it mostly fine on dev.libretexts.org. The restart and run all button is kind of inconsistent, sometimes it seems to work and sometimes not. In the screenshot from libretexts I posted above, the "incompatible glossery" line is not on any of the other sites, so that may be an issue. Otherwise, it's running fine on math library now with no future javascript error, and I can't see any real differences from query and dev.

I do believe the original issue is still present, it's just inconsistent.

mandeepika commented 3 years ago

I'm able to run it mostly fine on dev.libretexts.org. The restart and run all button is kind of inconsistent, sometimes it seems to work and sometimes not. In the screenshot from libretexts I posted above, the "incompatible glossery" line is not on any of the other sites, so that may be an issue. Otherwise, it's running fine on math library now with no future javascript error, and I can't see any real differences from query and dev.

I am thinking that "incompatible glossary" line error might not be the issue causing it to not work. Because the error still pops up even when it runs fine on libretexts.

image

mandeepika commented 3 years ago

So that sounds like the bug is on our end, not thebe's?

Yeah, I tried it multiple times but it seems to be working fine with thebe without giving any errors at all.

image

moorepants commented 3 years ago

@pstaabp Can you check things now? We've pushed a newer version of thebe that may have fixed the issues.

moorepants commented 3 years ago

After a few tries on https://math.libretexts.org/Bookshelves/Scientific_Computing_Simulations_and_Modeling/Book%3A_Scientific_Computing_(Staab)/04%3A_Intro_to_Functions/4.03%3A_Multiple_Dispatch, it doesn't seem like pressing "Restart & Run All" when first arriving on the page works. You always have to press "run" first, then "restart & run all works".

moorepants commented 3 years ago

I just tried this page https://chem.libretexts.org/Courses/Remixer_University/LibreTexts_Construction_Guide/05%3A_Interactive_Elements/5.02%3A_Jupyter_Notebooks_(Executable_Programming_Code_and_Figures)/5.2.08%3A_Using_ipywidgets_for_Interactivity/5.2.8.01%3A_Enabling_and_Using_Interactive_Matplotlib_Features, and pressing "restart & run all" as the very first thing, also doesn't work.

Note that it does work on query: https://query.libretexts.org/Sandboxes/jupyterteam@ucdavis.edu

moorepants commented 3 years ago

Is that incompatible glossary error something. Maybe that's a clash on chem but not on query.

moorepants commented 3 years ago

@Miniland1333 Can you shed light on the "incompatible glossary" error?

sandertyu commented 3 years ago

Thebe 0.7.1 and jlab3/julia-1.6 are not deployed on the production libraries, but they are on query. We think that the incompatible glossary error is not causing the issue, but we're not exactly sure of its source.

moorepants commented 3 years ago

When I go to the chem page above, it gives me binder plugin 1.8.1, which, as far as I can tell, is when thebe 0.7.1 was added.

sandertyu commented 3 years ago

1.8.1 is still using Thebe 0.6.0. The current staging branch has Thebe 0.7.1 and the new default-env image, but it needs more complete testing before we release it to production. 1.8.1 only included some security updates to our dependencies.

moorepants commented 3 years ago

Got it, I didn't notice that staging was the default branch on this repo.

Miniland1333 commented 3 years ago

@Miniland1333 Can you shed light on the "incompatible glossary" error?

That error is from the unrelated glossarizer code and that student recommended that we swap that error to console.debug. That error should disappear from the console once we make that change.

moorepants commented 3 years ago

@pstaabp Can you try your Julia pages again? We've updated to a more recent version of thebe. It seems to work for me, but the initial cell still takes some time.

pstaabp commented 3 years ago

It appears to be working.

I have a couple of requests ( and I can post in a new issue if that would help):

  1. I know startup on Julia is slow, but once it's going it's fast. Can you implement some way similar to the JupyterLab [*] on a cell to indicate that it is waiting on that cell?
  2. Where do you request packages to be added so I don't need to do a using Pkg; Pkg.add("Plots") for example.
moorepants commented 3 years ago

It appears to be working.

Great!

I know startup on Julia is slow, but once it's going it's fast. Can you implement some way similar to the JupyterLab [*] on a cell to indicate that it is waiting on that cell?

Yes this should be possible, but would need to be added to https://github.com/executablebooks/thebe. We're working on getting the jupyterwidgets fully functional this summer but if there is time we can try to implement the indicator too.

Where do you request packages to be added so I don't need to do a using Pkg; Pkg.add("Plots") for example.

Either email jupyterteam@ucdavis.edu, make an issue (or pull request) here https://github.com/LibreTexts/default-env. The Project.toml file in that default-env repository is where we'd add Julia packages.

moorepants commented 3 years ago

I'm going to close this issue as fixed.

moorepants commented 3 years ago

@pstaabp there is a new open pull request on thebe to add the computing indicator: https://github.com/executablebooks/thebe/pull/424 Feedback is welcome there.

moorepants commented 3 years ago

@pstaabp We have added the computation status indicator to LIbretexts now. There is a spinner to the right of the "restart and run all" button:

image