Skip to content

Worker Cron Trigger 0.1.0

UTCのcronスケジュールに従ってWorkerのscheduledハンドラーを呼び出します。

公開パッケージの内容を取得して検証済みです。

Hostの対応や受け入れ判断は、パッケージの公開とは別です。このバージョンを使う前に、利用先のHostで確認してください。

使い方

少なくとも1回の配信で、実行できなかった過去の予定を後から補いません。対象のWorkerにはscheduledハンドラーが必要です。重複配信されても安全に処理できるように実装してください。

関連するForms: ModuleWorker 0.1.0 · WorkerVersion 0.3.0

定義の説明(英語原文)

Attaches one cron schedule to a Module Worker, invoking its scheduled handler at each match. Schedules are interpreted in UTC only; there is no timezone field, so two hosts can never fire the same trigger at different instants and no schedule ever skips or repeats an hour for a daylight-saving transition. The grammar is five fields separated by single spaces — minute 0-59, hour 0-23, day-of-month 1-31, month 1-12, day-of-week 0-6 with 0 Sunday — and each field is a comma-separated list of `*`, a literal, a range `low-high`, `*/step`, or `low-high/step`. Names and a step on a bare literal are not accepted, and neither is any value outside its field's own range, an inverted range, or a step outside 1..span. When day-of-month and day-of-week are BOTH restricted the trigger fires on a day either of them selects; when only one is restricted only that one constrains the day. A missed run is not made up: a host that could not fire a match — because it was unavailable, or because the previous invocation was still running — skips it rather than firing late, so a schedule never produces a backlog. At-least-once delivery applies to each match: a handler may be invoked more than once for one matched minute, and it must be idempotent. An uncaught exception in the handler is a failed invocation reported to host diagnostics; it is not retried within the matched minute and it never becomes an HTTP response.

設定項目

項目名とスキーマ内の説明は、パッケージに含まれる英語の原文です。日本語の解説は定義に要件を追加するものではありません。

cron

必須 · string

Portable five-field cron expression, interpreted in UTC only. The pattern bounds the shape; a host also parses it and refuses a value outside its field's range, an inverted range, or an out-of-span step.

  • maxLength: 64
  • pattern: "^(?:\*(?😕[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?😕[0-9]{1,2})?)?)(?😢?:\*(?😕[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?😕[0-9]{1,2})?)?))*(?: (?:\*(?😕[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?😕[0-9]{1,2})?)?)(?😢?:\*(?😕[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?😕[0-9]{1,2})?)?))*){4}$"

worker

必須 · object

Module Worker whose scheduled handler this trigger invokes.

  • additionalProperties: false

設定の例

パッケージに含まれるfixtures/desired.jsonをそのまま掲載しています。完全なHost APIリクエストやOpenTofuの設定ではありません。例のリソース参照とArtifactのダイジェストは、実際の値に置き換えてください。このJSONだけでリソースが作成されることはありません。

json
{
  "cron": "*/5 * * * *",
  "worker": {
    "apiVersion": "edge.forms.takoform.com",
    "kind": "ModuleWorker",
    "name": "module-worker"
  }
}

例の原文を見る

設定のスキーマ全文(英語原文)

入れ子の項目、選択肢、すべてのスキーマ制約を以下に掲載しています。Hostが検証する意味上の規則は、定義の説明にも記載されています。

json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Attaches one cron schedule to a Module Worker, invoking its scheduled handler at each match. Schedules are interpreted in UTC only; there is no timezone field, so two hosts can never fire the same trigger at different instants and no schedule ever skips or repeats an hour for a daylight-saving transition. The grammar is five fields separated by single spaces — minute 0-59, hour 0-23, day-of-month 1-31, month 1-12, day-of-week 0-6 with 0 Sunday — and each field is a comma-separated list of `*`, a literal, a range `low-high`, `*/step`, or `low-high/step`. Names and a step on a bare literal are not accepted, and neither is any value outside its field's own range, an inverted range, or a step outside 1..span. When day-of-month and day-of-week are BOTH restricted the trigger fires on a day either of them selects; when only one is restricted only that one constrains the day. A missed run is not made up: a host that could not fire a match — because it was unavailable, or because the previous invocation was still running — skips it rather than firing late, so a schedule never produces a backlog. At-least-once delivery applies to each match: a handler may be invoked more than once for one matched minute, and it must be idempotent. An uncaught exception in the handler is a failed invocation reported to host diagnostics; it is not retried within the matched minute and it never becomes an HTTP response.",
  "properties": {
    "cron": {
      "description": "Portable five-field cron expression, interpreted in UTC only. The pattern bounds the shape; a host also parses it and refuses a value outside its field's range, an inverted range, or an out-of-span step.",
      "maxLength": 64,
      "pattern": "^(?:\\*(?:/[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?:/[0-9]{1,2})?)?)(?:,(?:\\*(?:/[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?:/[0-9]{1,2})?)?))*(?: (?:\\*(?:/[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?:/[0-9]{1,2})?)?)(?:,(?:\\*(?:/[0-9]{1,2})?|[0-9]{1,2}(?:-[0-9]{1,2}(?:/[0-9]{1,2})?)?))*){4}$",
      "type": "string"
    },
    "worker": {
      "additionalProperties": false,
      "description": "Module Worker whose scheduled handler this trigger invokes.",
      "properties": {
        "apiVersion": {
          "const": "edge.forms.takoform.com",
          "type": "string"
        },
        "kind": {
          "const": "ModuleWorker",
          "type": "string"
        },
        "name": {
          "maxLength": 63,
          "minLength": 1,
          "pattern": "^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$",
          "type": "string"
        }
      },
      "required": [
        "apiVersion",
        "kind",
        "name"
      ],
      "type": "object",
      "x-takoform-required-entrypoint": "scheduled",
      "x-takoform-required-interface": {
        "apiVersion": "interfaces.takoform.com/v1alpha1",
        "name": "worker.runtime",
        "schemaDigest": "sha256:ed2f8211aac5be94488d391945ca6aca7627a4ecbd261e39790093e887feae08",
        "version": "1.1.0"
      }
    }
  },
  "required": [
    "cron",
    "worker"
  ],
  "title": "Worker Cron Trigger desired state",
  "type": "object"
}

ライフサイクル

役割: attachment

  • create
  • read
  • update
  • delete
  • import
  • observe

提供するInterface

ありません。

パッケージ参照

項目
KindWorkerCronTrigger
Package digestsha256:562df22aa6d3d1ad47f308c6dee65fe242bc5c53f811a3b03344747b67c7dc3c
Schema digestsha256:5faa838c794b3326d0377d641db6247d4320b6ce39b1b0bb660d4deec18fe5ed
Tagforms/k-mvsgozjomzxxe3ltfz2gc23pmzxxe3jomnxw2l2xn5zgwzlsinzg63suojuwoz3foi/sha256-562df22aa6d3d1ad47f308c6dee65fe242bc5c53f811a3b03344747b67c7dc3c
Source pathforms/releases/k-mvsgozjomzxxe3ltfz2gc23pmzxxe3jomnxw2l2xn5zgwzlsinzg63suojuwoz3foi/sha256-562df22aa6d3d1ad47f308c6dee65fe242bc5c53f811a3b03344747b67c7dc3c
署名セットe7f8a39311dd011b8467e97e7f300cabb9a6b06c

変更不可のパッケージを開く

4項目のFormRef
json
{
  "apiVersion": "edge.forms.takoform.com",
  "kind": "WorkerCronTrigger",
  "definitionVersion": "0.1.0",
  "schemaDigest": "sha256:5faa838c794b3326d0377d641db6247d4320b6ce39b1b0bb660d4deec18fe5ed"
}