AppEngine cron(python)中的每一天,每周,每一年,每一年

Axa*_*dax 13 python cron google-app-engine

我试图在每天,每周,每月和每年的午夜重复设置一个appengine任务,以清除游戏的高分列表.

我的cron.yaml看起来像这样:

- description: daily clear
  url: /delete?off=10
  schedule: every day 00:00
- description: weekly clear
  url: /delete?off=20
  schedule: every monday 00:00
- description: monthly clear
  url: /delete?off=30
  schedule: every month 00:00
- description: yearly clear
  url: /delete?off=40
  schedule: every year 00:00
Run Code Online (Sandbox Code Playgroud)

每日和每周的工作都可以,但我无法弄清楚如何每个月和每年重复工作.这是日程表格式.

对于每个月的工作,我都尝试过"每个月","每月1日"等表达方式,但没有任何效果.这种计划在cron工作中是否可行?

或者我是否只需要每天00:00调用清算页面,并在页面中执行此逻辑并测试当前日期,如果它是周/月/年的开始?

Rob*_*uin 23

您链接的文档提供了如何实现所需结果的示例.

# Daily:
every day 00:00

# Weekly:
every monday 00:00

# Monthly:
1 of month 00:00

# Yearly:
1 of jan 00:00
Run Code Online (Sandbox Code Playgroud)

  • @Robert你是对的:),它在规范中报道; 这很奇怪,因为它不遵循上面指定的("每个"|序数)语法. (2认同)