Long callback doesn't work in jupyter notebook
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Describe your context
Please provide us your environment, so we can easily reproduce the issue.
- replace the result of
pip list | grep dashbelow
dash 2.3.1
dash-bootstrap-components 1.1.0
dash-bootstrap-templates 1.0.5
dash-core-components 2.0.0
dash-extensions 0.1.3
dash-html-components 2.0.0
dash-loading-spinners 1.0.0
dash-table 5.0.0
Describe the bug
'running options’ in long callback are not working correctly when used with JupyterDash
Expected behavior
'running options' in long callbacks should work the same way in JupyterDash as they work in regular Dash
Screenshots
Cell output in the jupyter notebook (button is never enabled):
Error which showed in the cell after a while of running:
ProcessLookupError: [Errno 3] assume no such process (originated from NtQuerySystemInformation (no PID found))
During handling of the above exception, another exception occurred:
NoSuchProcess Traceback (most recent call last)
NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=10268)
Here example 2 from the official guide changed to use JupyterDash instead of Dash, where button is never re-enabled (the 'running option' which should been applied at the end of the callback):
from jupyter_dash import JupyterDash
import time
import dash
from dash import html
from dash.long_callback import DiskcacheLongCallbackManager
from dash.dependencies import Input, Output
import diskcache
cache = diskcache.Cache("./cache")
long_callback_manager = DiskcacheLongCallbackManager(cache)
app = JupyterDash(__name__, long_callback_manager=long_callback_manager)
app.layout = html.Div(
[
html.Div([html.P(id="paragraph_id", children=["Button not clicked"])]),
html.Button(id="button_id", children="Run Job!"),
]
)
@app.long_callback(
output=Output("paragraph_id", "children"),
inputs=Input("button_id", "n_clicks"),
running=[
(Output("button_id", "disabled"), True, False),
],
)
def callback(n_clicks):
time.sleep(2.0)
return [f"Clicked {n_clicks} times"]
if __name__ == "__main__":
app.run_server(debug=True, mode='inline', port=2006)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied JupyterDash example with its long callback and running option, then compare the button state with the regular Dash behavior described in the official guide. Done means the button is re-enabled after the callback completes and the reported process lookup error does not occur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100