简体   繁体   English

如何安排 Python 脚本在每天的特定时间运行,并使其成为 AWS Elastic Beanstalk 应用程序 zip 文件的一部分?

[英]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.

相关问题 我可以使用 AWS Elastic Beanstalk 托管 Spring Boot 应用程序吗 - Can I use AWS Elastic Beanstalk to host a Spring Boot application 如何在要部署到 AWS 弹性豆茎中的 Flask 应用程序中使用我的 firebase 凭证? - How can I use my firebase credentials in a Flask application that I want to deploy in a AWS elastic beanstalk? 如何在 Elastic Beanstalk 中安排每晚重启应用程序服务器 - How to schedule nightly restart of application server in Elastic Beanstalk 如何使用 Amazon AWS Elastic Beanstalk 部署私有 python pip 依赖项? - How to deploy private python pip dependency with Amazon AWS Elastic Beanstalk? 替换 AWS Elastic BeanStalk 上的特定实例? - Replacing a particular instance on AWS Elastic BeanStalk? 我将如何为 Terraform 上的 AWS Elastic Beanstalk 定义 URL/域? - How would I define the URL/Domain for AWS Elastic Beanstalk on Terraform? 如何在 Elastic Beanstalk 上添加 PATH - How can I add PATH on Elastic Beanstalk 如何将 LetsEncrypt SSL 安装到运行 Tomcat 8 和 Java 8 平台的 AWS Elastic Beanstalk 应用程序上 - How do I install LetsEncrypt SSL onto AWS Elastic Beanstalk application running Tomcat 8 with Java 8 Platform 如何配置 AWS CodePipeline、CodeBuild 和 Elastic Beanstalk 以正确部署 Laravel 8 应用程序? - How do I configure AWS CodePipeline, CodeBuild, and Elastic Beanstalk to deploy a Laravel 8 application correctly? 无法在弹性 beantalk 中运行后台应用程序 - Failed to run a background application in elastic beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM