plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.45k stars 2.07k forks source link

Add `ping` service to Dash #1360

Open Marc-Andre-Rivet opened 4 years ago

Marc-Andre-Rivet commented 4 years ago

Some apps can take many minutes to initialize. During this time no progress messages are printed to the logs. Regular progress messages (1 every 10 seconds) should be printed so the app owner can tell what's happening.

https://github.com/plotly/dash-enterprise-docs/issues/561

Marc-Andre-Rivet commented 4 years ago

From weekly meeting consensus was that having a ping service would be useful in determining if the app is ready - even if it wouldn't help know if the app is hanging. The service would start responding after run_server gets executed.

@gzork If you have additional feedback.

deepstqte commented 4 years ago

We could use the CHECKS file mechanism in Dash Enterprise to only finish the deployment when a certain endpoint is accessible. The dokku documentation is here (Also documented in Dash Enterprise on /Docs/dash-enterprise/checks).

chriddyp commented 4 years ago

We could use the CHECKS file mechanism in Dash Enterprise to only finish the deployment when a certain endpoint is accessible.

We already use the /_dash-layout endpoint for this. Is there any advantage to using ping instead of /_dash-layout?

chriddyp commented 4 years ago

Regular progress messages (1 every 10 seconds) should be printed so the app owner can tell what's happening.

How will this work architecturally? Some background process that gets kicked off?

deepstqte commented 4 years ago

Is there any advantage to using ping instead of /_dash-layout?

@chriddyp If I'm not mistaken /_dash-layout waits for the layout and the callbacks to finish the execution right ? In this case, my understanding is that the code that takes time to finish the execution is the code in publish_data.py which is not tied to a callback. CHECKS could help since it could be customised to what we check for. Though we could add a dummy callback that's tied to the slow code in publish_data.py and make this callback only return something (e.g. True) once the slow code execution has ended.

I could be misunderstanding or missing something though.

alexcjohnson commented 4 years ago

The advantage of ping is just avoiding layout generation, in case that’s an expensive function, and keeping the network load small in case the layout has a ton of data in it. Not a huge deal, but then it’s not a big feature to add if it provides some value.

nhoover commented 3 years ago

I agree with the above and it seems like adding ping would also be good for monitoring. Or in my case, to simply implement a keep alive via cron in an environment like free Heroku where your app is taken down after 30 minutes of inactivity.