简体   繁体   English

Google App Engine Python Cron作业

[英]Google App Engine Python Cron Job

I wanted to run my cron job as 'schedule: every saturday every 2 minutes from 01:00 to 3:00', and it won't allow this format. 我想将我的Cron作业设置为“时间表:每星期六每2分钟从01:00到3:00”,并且不允许这种格式。 Is it possible to set a cron job to target another cron job? 是否可以将cron作业设置为目标另一个cron作业? Or is my schedule possible just not in the correct format? 还是我的时间表可能格式不正确?

Unfortunately, you cannot combine the weekday option with the interval. 不幸的是,您不能将工作日选项与时间间隔结合使用。

You could add a switch in the request handler of your cron-job, that will just exit if current week-day is not Saturday, while your cron.job is scheduled "every 2 minutes from 01:00 to 03:00". 您可以在cron-job的请求处理程序中添加一个开关,如果当前工作日不是星期六,该开关将退出,而cron.job则计划为“从01:00到03:00每2分钟”。 But that means that your handler will be called 300 times per week for doing nothing, and only doing something the other 60 times. 但这意味着您的处理程序每​​周将被呼叫300次,无事可做,而其他事情仅做60次。

Alternatively, you could combine an "every saturday 01:00" cron-job (as dispatcher) that will create 60 push tasks (as worker) with countdown or ETA, spread between 01:00 and 03:00. 或者,您可以组合一个“每周六01:00” cron-job(作为调度程序),它将创建60个具有倒计时或ETA的推送任务(作为工作人员),在01:00和03:00之间进行。 However, I don't think the execution time is not guaranteed. 但是,我认为执行时间不能保证。

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

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