[英]How can I schedule a Python script to run at a particular time every day, and make it a part of AWS Elastic Beanstalk application zip file?
I've created an application using Dash and uploaded it to AWS Elastic Beanstalk.我使用 Dash 创建了一个应用程序并将其上传到 AWS Elastic Beanstalk。 There is another python script which is responsible for updating the database (from which data is then extracted by the dashboard).
还有另一个 python 脚本负责更新数据库(然后仪表板从中提取数据)。 I used apscheduler to schedule that script to run daily on my local machine but when I make that script a part of the zip package that I upload on AWSEB, it doesn't work.
我使用 apscheduler 安排该脚本每天在我的本地计算机上运行,但是当我将该脚本作为我上传到 AWSEB 的 zip package 的一部分时,它不起作用。 How can I fix this?
我怎样才能解决这个问题? I'd really appreciate any help.
我真的很感激任何帮助。
One option would be to pull the "timed" Python script out into a dedicated lambda function. With that in hand, you could trigger via AWS EventBridge on a cron style schedule.一种选择是将“定时”Python 脚本拉出到专用的 lambda function 中。有了它,您可以通过 AWS EventBridge 按 cron 样式计划触发。 You can define other inputs as well but that would get you very close.
您也可以定义其他输入,但这会让您非常接近。
Alternatively, I came across this blog post which may be of interest.或者,我偶然发现了这篇可能感兴趣的博客文章。 Good luck!
祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.