简体   繁体   English

如何解释cron.yaml文件中的URL参数?

[英]How to interpret the URL parameter in the cron.yaml file?

In AWS worker environment, I would like to apply a cron.yaml in parallel with an application.py file. 在AWS worker环境中,我想将cron.yamlapplication.py文件并行应用 The cron.yaml should execute at periodic intervals a data processing pipeline, that will be a Python script. cron.yaml应该定期执行数据处理管道,该管道将是Python脚本。 In the documentation on the web, I often see something like the following in the cron.yaml file, but I am at odds what the url parameter exactly means for the data structure. 在网上的文档中,我经常在cron.yaml文件中看到类似以下内容的内容,但与url参数对于数据结构的确切含义不同。

version: 1
cron: 
- name: "every-30-minutes-task"
  url: "/task1"
  schedule: "*/30 * * * *"
- name: "every-hour-task"
  url: "/task2"
  schedule: "0 * * * *"

Does it mean that there is a folder « task1 » and inside there should be a separate file with the script (for ex. app.py), that executes the scheduled cron job, and if so, which name should it have. 这是否意味着有一个文件夹“ task1”,并且里面应该有一个包含脚本的单独文件(例如,app.py),该文件将执行计划的cron作业,如果是,则应使用哪个名称。 Or should everything be put in a single script in the root? 还是应该将所有内容放在根目录下的单个脚本中?

The URL should be a POST route. 该URL应该是POST路由。 That means when a POST request is sent to www.yourdomain.com/task1 , the logic of the controller associated to this route will be executed. 这意味着当POST请求发送到www.yourdomain.com/task1 ,将执行与此路由关联的控制器的逻辑。 So, what you have to do is to set up a controller which will call your script. 因此,您要做的是设置一个将调用脚本的控制器。

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

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