Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbgrader + ipywidgets causes timeouts #6137

Closed
williamstein opened this issue Sep 23, 2022 · 7 comments
Closed

nbgrader + ipywidgets causes timeouts #6137

williamstein opened this issue Sep 23, 2022 · 7 comments

Comments

@williamstein
Copy link
Contributor

williamstein commented Sep 23, 2022

In comments on #5276 it was reported that combining ipywidgets with nbgrader causes timeouts/hangs/resets. Fix this.

@mforbes
Copy link

mforbes commented Nov 8, 2022

Some magics also cause nbgrader to timeout:

import qiskit.tools.jupyter
%qiskit_version_table

One can install qiskit as follows:

try:
    import qiskit
except ImportError:
    import sys
    !{sys.executable} -m pip install --user qiskit[visualization]
    print("Restart your kernel and try again")

@williamstein
Copy link
Contributor Author

I wonder if I should add some sort of way to add metadata to the instructor notebook that has the impact: "do not include this cell in any way when grading?"

That seems easy to implement. Doing something specific to ipywidgets or qiskit, etc., seems impossibly hard overall, since things like this will keep popping up. Alternatively, changing the instructor notebook slightly could -- at any point, even after assigning and collecting -- change how grading happens. And it would be easy to implement something to keep cells from being included in the grading process. Thoughts?

@mforbes
Copy link

mforbes commented Nov 8, 2022

Excepting a way to fix the underlying issues, the real problem for me is that there is no easy way as an instructor to figure out which cells might be problematic. Running Validate works fine, and it is only after collecting and grading assignments that the instructor finds out there is a problem. Is there some way for "Validate" to be run properly through the nbgrader machinery? (Maybe create a "Test Student" account for doing this... of course with a unique ID that does not send poor Mr. Student to Null Island).

Some way of retroactively excluding or modifying cells would help though.

@williamstein
Copy link
Contributor Author

Excepting a way to fix the underlying issues,

That's a very good point. I should just fix the underlying issue. I wonder precisely how these things cause a hang.

@mforbes
Copy link

mforbes commented Nov 8, 2022

Is there a way to simulate how nbgrader is run? I don't have a very good idea what it does under the hood.

@williamstein
Copy link
Contributor Author

I'll try to fix this bug this week. I'm very intrigued by why there is any hang at all -- it doesn't make sense, so I want to understand it.

@williamstein
Copy link
Contributor Author

Good news -- I found what I think was the bug and fixed it in 5b0883f

Basically some code (especially widgets) accessed the "_actions" field of some class, which isn't set when using nbgrader.

The fix should be live within an hour, if all the building/testing works fine. The fix requires the project that will actually be running the code to be restarted if it is currently running. Of course, any project that starts after the fix is deployed is updated to have the fix.

echarles pushed a commit to datalayer-externals/cocalc that referenced this issue Nov 12, 2022
- if a notebook used a ipywidgets this would cause an error, which made
the grading timeout.  I fixed that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants