You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, here's a MWE to reproduce this issue:
Here are the module versions:
plotly-resampler==0.8.3.1
Flask==2.1.3
jupyter-dash==0.4.2
Werkzeug==2.1.2
import plotly.graph_objects as go; import numpy as np
from plotly_resampler import FigureResampler
import time
import threading
x = np.arange(1_000_000)
sin = (3 + np.sin(x / 200) + np.random.randn(len(x)) / 10) * x / 1_000
fig = FigureResampler(go.Figure())
fig.add_trace(go.Scattergl(name='noisy sine', showlegend=True), hf_x=x, hf_y=sin)
threading.Thread(target=fig.show_dash, kwargs={"mode": "external", "port":8050}, daemon=True).start()
start_time = time.time()
while True:
if time.time() - start_time > 10:
print("Time to stop!")
fig.stop_server()
print("Stop server ran!")
break
# This loop is meant to keep the script alive
while True:
pass
If the fig.stop_server() function is working, refreshing the browser: 127.0.0.1:8050 should yield a "SITE CANNOT BE REACHED ERROR" which is expected if the dash server is functional.
However, that is not the case, and the server is still alive. Please kindly advise, how one can go about terminating the server, without having to terminate the entire python script.
The text was updated successfully, but these errors were encountered:
Thx for submitting this issue together with the qualitative reproducible code :)
I ran this code on my machine, but could not reproduce the bug (the server stops after 10s, and I get this This site can’t be reached in the browser when I reload).
Are you by any chance working on Windows? I'm not an expert on this, but I do know that multiprocessing (& possibly threading) on Windows is performed differently than on Unix systems...
Hope to get this sorted out!
Cheers, Jeroen
P.S.: my apologies for the late response - had some paper deadlines that limited my spare time (to work on open-source contributions)
I further looked into this, and it appears that this code works as-expected when running this within a Jupyter cell (using Ipython kernel); this activates the JupyterDash component of Dash which allows (for some yet unknown reason, to behave as expected).
If you use this as a python script, this code does not work as expected, and the just-started server is not found in the server_dict and can thus be not killed.
Hi, here's a MWE to reproduce this issue:
Here are the module versions:
If the
fig.stop_server()
function is working, refreshing the browser:127.0.0.1:8050
should yield a "SITE CANNOT BE REACHED ERROR" which is expected if the dash server is functional.However, that is not the case, and the server is still alive. Please kindly advise, how one can go about terminating the server, without having to terminate the entire python script.
The text was updated successfully, but these errors were encountered: