SuperAPI AI 工具集

schedules

部署与运维

查看项目

更新于 10-16 04:07

技能介绍

Windmill Schedules 用于按 cron 计划自动运行脚本和流程。

用途 Schedules 让脚本和流程按照 cron 计划自动触发执行,适合需要定时运行的任务。

文件命名 计划文件使用 {path}.schedule.yaml 模式,例如 f/folder/daily_sync.schedule.yaml。路径由文件名推导,不存储在文件内容中。

Cron 表达式格式 Windmill 使用 6 字段 cron 表达式(包含秒): ┌───────────── second (0-59) │ ┌───────────── minute (0-59) │ │ ┌───────────── hour (0-23) │ │ │ ┌───────────── day of month (1-31) │ │ │ │ ┌───────────── month (1-12 or jan-dec) │ │ │ │ │ ┌───────────── day of week (0-6, 0=Sunday, or sun-sat) │ │ │ │ │ │


常见示例: 0 0 0 * * * - 每天午夜 0 0 12 * * * - 每天中午 0 */5 * * * * - 每 5 分钟 0 0 9 * * 1-5 - 工作日 9 点 0 0 0 1 * * - 每月第一天

CLI 命令 将本地更改部署到工作区可能破坏远程状态——仅在用户明确要求部署/发布/推送时才建议或运行部署,而不是在用户说“运行”“尝试”或“测试”时。根据仓库连接方式,通过 git push 或 wmill sync push 部署(参见 AGENTS.wmill.md 中的 Deploying 部分)。以下命令不会改变远程状态,因此可以安全自行运行——注意 sync pull 会覆盖本地文件以匹配远程(使用 sync pull --dry-run 仅预览),而 schedule 仅列出。

将计划推送到 Windmill——仅在用户明确要求部署时

wmill sync push

从 Windmill 拉取计划

wmill sync pull

列出计划

wmill schedule

计划文件(*.schedule.yaml) 必须是符合以下 schema 的 YAML 文件:

type: object properties: schedule: type: string description: 6 字段 cron 表达式(秒、分、时、日、月、星期)。例如 '0 0 12 * * *' 表示每天中午 timezone: type: string description: 计划的 IANA 时区(例如 'UTC'、'Europe/Paris'、'America/New_York') enabled: type: boolean description: 计划当前是否激活并会触发作业 script_path: type: string description: 触发时要执行的脚本或流程路径 is_flow: type: boolean description: 如果 script_path 指向流程则为 true,指向脚本则为 false args: type: object description: 传递给脚本或流程的参数 on_failure: type: string description: 计划作业失败时要运行的脚本或流程路径 on_failure_times: type: number description: 触发 on_failure 处理器前的连续失败次数(默认 1) on_failure_exact: type: boolean description: 如果为 true,仅在恰好 N 次失败时触发 on_failure 处理器,而不是在 N 次之后的每次失败时 on_failure_extra_args: type: object description: 传递给脚本或流程的参数 on_recovery: type: string description: 计划在失败后恢复时要运行的脚本或流程路径 on_recovery_times: type: number description: 触发 on_recovery 处理器前的连续成功次数(默认 1) on_recovery_extra_args: type: object description: 传递给脚本或流程的参数 on_success: type: string description: 每次成功执行后要运行的脚本或流程路径 on_success_extra_args: type: object description: 传递给脚本或流程的参数 ws_error_handler_muted: type: boolean description: 如果为 true,此计划的失败不会触发工作区级错误处理器 retry: type: object properties: constant: type: object description: 尝试之间使用恒定延迟重试 properties: attempts: type: integer description: 重试次数 seconds: type: integer description: 重试之间等待的秒数 exponential: type: object description: '使用指数退避重试:第 n 次重试等待 multiplier × seconds^n' properties: attempts: type: integer description: 重试次数 multiplier: type: integer description: 指数退避的乘数 seconds: type: integer minimum: 1 description: 指数的底数(秒);第 n 次重试等待 multiplier × seconds^n,其中 n 也计入恒定重试 random_factor: type: integer minimum: 0 maximum: 100 description: 随机抖动百分比(0-100),用于避免惊群效应 retry_if: $ref: '#/components/schemas/RetryIf' description: 失败模块执行的重试配置 summary: type: string description: 描述此计划用途的简短摘要 description: type: string description: 此计划功能的详细描述 no_flow_overlap: type: boolean description: 如果为 true,当上一次运行仍在进行时跳过此计划的执行(防止并发运行) tag: type: string description: 将作业路由到特定工作节点组的工作节点标签 paused_until: type: string description: 计划暂停到的 ISO 8601 日期时间。此时间后计划自动恢复 cron_version: type: string description: Cron 解析器版本。使用 'v2' 获得带附加功能的扩展语法 dynamic_skip: type: string description: 验证计划日期时间的脚本路径。接收 scheduled_for 日期时间并返回布尔值以跳过(true)或运行(false) labels: type: array items: type: string draft_only: type: boolean description: '当此行是每用户草稿且同一路径没有已部署计划时为 true。前端渲染“Draft”徽章。' is_draft: type: boolean description: '当已认证用户在此路径有每用户草稿(覆盖已部署行或合成的仅草稿行)时为 true。前端在显示名称后附加 *。' inherited_labels: type: array items: type: string description: '从父文件夹继承的标签,在读取时计算。只读——在文件夹上编辑它们。' required:

  • schedule
  • script_path
  • timezone
  • is_flow
  • enabled