Dash - 在服务器端运行回调
早上好,
我在 Dash 中创建了一个回调,它可以充当调度程序。 每 10 分钟(在间隔组件的帮助下),我的回调就会运行以从服务器获取数据并更新我在应用程序中使用的 csv 文件。
问题是只有当我打开网页时才会调用我的回调。一旦我关闭页面,调度程序就会停止并在我再次打开页面时再次运行。
由于更新数据的数据过程有时可能很长,因此我希望调度程序始终每 10 分钟运行一次并获取数据。
我假设回调是客户端进程,对吧?那么如何让它在服务器端运行呢?
谢谢你,
Good morning,
I have created a callback in Dash that makes the job of a scheduler.
Every 10 minutes (with the help of an interval component), my callback is running to fetch the data from a server and to update the csv file that I use in my app.
The problem is that my callback is called only when I have the webpage opened. As soon as I close the page, the scheduler stops and runs again when I open the page again.
As the data process of updating data can be long sometimes, I want the scheduler to always run and fetch the data every 10 minutes.
I assume that a callback is a client side process right? So how can I make it run in server side?
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
达世币可能不是这个问题的正确解决方案。我认为在一个简单的
.py
脚本文件中设置此作业所需的 Python 代码,并设置一个 cron 作业每 10 分钟运行该脚本会更有意义。Dash is probably not the right solution for this. I think it would make more sense to set up the Python code you need for this job in a simple
.py
script file, and set a cron job to run that script every 10 min.谢谢@coralvanda 的帮助。
我最终在容器 A 中编写了一个 python 脚本,每 10 分钟调用一次容器 B。容器B正在获取数据。
它完成了工作。
Thank you @coralvanda for the help.
I finally did a python script in my container A that calls the container B every 10 minutes. The container B is fetching the data.
It makes the job.