简体   繁体   English

在Google App Engine的暂存环境中处理Cron作业

[英]Handling cron jobs on staging environment on google app engine

I want to set up a staging environment on Google App Engine and have found good guidance for this in the following question: How to set up a staging environment on Google App Engine 我想在Google App Engine上设置登台环境,并在以下问题中找到了很好的指导: 如何在Google App Engine上设置登台环境

The only unanswered question I have is how to handle Cron jobs in this case. 我唯一未解决的问题是在这种情况下如何处理Cron作业。 Ideally I'll just have to change the version to deploy to production, however I fear that that would mean that all cron jobs also run on the staging version, or is this not the case? 理想情况下,我只需要更改版本以部署到生产环境,但是我担心那将意味着所有cron作业也都在登台版本上运行,不是这样吗?

If you're using a different version approach you need to pay attention to this : 如果您使用其他版本方法,则需要注意以下事项

If the target parameter has been set for a job, the request is sent to the specified version. 如果已经为作业设置了目标参数,则将请求发送到指定的版本。 Otherwise Cron requests are sent to the default version of the application. 否则,Cron请求将发送到应用程序的默认版本。

I've been using the target parameter to direct cron jobs to different modules, based on the quote above I guess it could be used to direct jobs to different versions as well, using module routing via URL , probably something like this: 我一直在使用target参数将cron作业定向到不同的模块,根据上面的引用,我猜想它也可以用于通过URL通过模块路由将作业定向到不同的版本:

  target: version

or 要么

  target: version-dot-module

Personally I prefer a different application approach to ensure no interference between the staging and the production environments, even when performing massive re-works breaking backwards compatibility :) 我个人更喜欢使用不同的应用程序方法,以确保在过渡和生产环境之间不会产生干扰,即使执行大量的返工也破坏了向后兼容性:)

As for the method, I use 2 different workspaces from 2 different branches of the code, which have minimal differences between them (the application fields in the .yaml files and maybe other staging-related deltas): 对于该方法,我使用代码的2个不同分支中的2个不同的工作区,它们之间的差异很小( .yaml文件中的application字段以及其他与暂存相关的增量)。

  • a staging workspace & branch staging工作区和分支
  • a production workspace & branch production工作区和分支

Whenever I'm happy with the code in the staging branch I: 每当我对staging分支中的代码感到满意时,我:

  • merge the staging branch in the production one 合并staging分支在production一个
  • update the production workspace and deploy from it -> updating the production app 更新production工作空间并从中进行部署->更新production应用
  • disable whatever I need in the staging workspace (committing the changes to the staging branch as well if so desired) 禁用staging工作空间中我需要的任何内容(如果需要,也将更改提交到staging分支)
  • deploy from the staging workspace -> updating the staging app staging工作空间进行部署->更新staging应用

Probably the method would be usable in a different version approach as well, the version fields in the .yaml files being different in the 2 branches. 该方法可能也可以在不同的版本方法中使用, .yaml文件中的version字段在两个分支中是不同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM