I just tried adding a long callback to a JupyterDash app and it looks like the ‘running options’ are not working correctly.
Here is example 2 from the official guide changed to run with JupyterDash:
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
## Diskcache
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)
The button is disabled straight away on start and it’s never re-enabled. After a while I can see this exception shown in the cell output:
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)
Similar problem with example 3, there the output doesn’t get set and it also prints a similar exception