每个服务/模块的Cron(AppEngine) [英] Cron per Service/Module (AppEngine)
问题描述
我有两个模块/服务,每个模块都有一个cron.xml。只有其中一个似乎运行(根据我的经验,最近部署),另一个不会失败,但端点永远不会被触发(从不在日志中显示)。
每个项目限制是否有1-cron?什么是管理crons的最好方法,以便模块不交叉相关?
cron.yaml 是应用程序级配置文件,而不是服务/模块。这意味着当你在一个模块中部署一个模块时,它会覆盖另一个模块的cron配置。因此,您必须创建一个单个 cron.yaml
文件,其中包含作业配置所有服务/模块。正如@GAEfan提到的,您还需要为每个作业添加 target
configs。您可能还需要添加一个 dispatch.yaml
文件,并可能重新访问/调整请求路径,以便发出cron作业发出的请求它到了正确的服务/模块。
部署应用程序级别 cron.yaml
当部署服务时不会隐式发生,您可能需要明确部署它。从
上传cron作业:
选项2:仅上传您的cron更新
只更新cron配置而无需上传应用程序的其余部分,运行以下命令:
appcfg.py update_cron< app-directory> ;
一些或多或少相关的问与答:
I have two modules/services and each one has a cron.xml. Only one of these ever seems to run (the most recently deployed in my experience), and the other doesn't fail, but the endpoint is never triggered (never shows up in the logs).
Is there a 1-cron per project limit? What is the best way to manage crons so that modules aren't cross-dependant?
The cron.yaml
is an app-level config file, not a service/module one. Meaning when you deploy the one you have in one module it'll overwrite the cron config from the other one.
So you have to create a single cron.yaml
file containing job configs for all services/modules. As @GAEfan mentioned you'll also need add target
configs for each job. You might also need to add a dispatch.yaml
file and maybe re-visit/adjust the request paths so that the cron job-issued requests make it to the right service/module.
Deploying the app-level cron.yaml
might not be happening implicitly when deploying the service(s), you may need to deploy it explicitly. From
Uploading cron jobs:
Option 2: Upload only your cron updates
To update just the cron configuration without uploading the rest of the application, run the following command:
appcfg.py update_cron <app-directory>
Some more or less related Q&As:
- Deploying different languages services to the same Application [Google App Engine]
- Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?
这篇关于每个服务/模块的Cron(AppEngine)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!