Files

103 lines
5.0 KiB
Markdown

# Saved run schedules
A schedule pairs a **pipeline and pinned version** with its own **run
information and timer**. It is not part of the workflow's Markdown.
For example, one Research pipeline can have a battery-news prompt every Monday,
an AI-news prompt every morning, and a comparison report every Friday—without
copying or editing the workflow. Each entry has an independent name, prompt,
workspace, timing, enabled state and revision.
## In the web app
1. Open a pipeline and choose **Schedules → Add schedule**.
2. Enter its name, prompt and existing **server workspace**. The browser's files
are not uploaded; this path is on the execution server.
3. Choose an interval (at least one minute) or 24-hour clock times, weekdays and
timezone. The editor prefills your browser's timezone; review it before saving.
Blank or `Local` uses the server's timezone.
4. Review whether it is **Enabled**, then save. Enabled entries start future runs
automatically, including provider usage and the workflow's permitted tools.
**Schedule this run** copies an existing run's original input and options—not its
output—into an editable schedule. Run-level `write_paths` restrictions are kept;
they never enable tools or widen workflow permissions. Advanced options include
extra typed inputs, model/stage overrides, notifications, title and output format.
Generated run titles are not silently locked in as explicit future titles.
Pause or delete affects future occurrences only. It does not cancel already
admitted work, delete run history or rewrite the pipeline. Publishing a new
workflow version also does not change an existing schedule's pinned version.
Edit that schedule explicitly when you want it to use a newer version.
## Filters and provenance
- **Pipelines → Filter → Scheduling → Has schedules** selects pipelines with
configured, nondeleted schedules, including paused ones. **No schedules** is
the opposite. The row shows the configured schedule count.
- **Runs → Filter → Trigger → Scheduled runs** selects executions actually
started by a timer. Manually running that same pipeline is **Not scheduled**.
The trigger/name remains recorded after a schedule is paused, edited or deleted.
- Records from older peers that omit scheduling metadata remain unclassified; the browser
never guesses from workflow Markdown or a current pipeline's schedule state.
Each dispatch is claimed once. Missed occurrences after downtime are skipped,
not replayed. Workspace conflicts are refused and journaled, not silently run
concurrently or retried as agent work. Use separate workspaces for truly
independent concurrent execution. **Refresh** in Schedules reloads its latest
configuration and next due times.
## JSON API / CLI automation
All commands are available through the existing `pipelines rpc -` interface.
These are real mutations, not dry runs; replace IDs and server paths first.
```sh
pipelines rpc - <<'JSON'
{
"type": "save_schedule",
"request_key": "schedule-battery-topic-creation-1",
"schedule": {
"name": "Battery research",
"pipeline_id": 7,
"version": 3,
"enabled": false,
"input": {"prompt": "Research battery recycling developments"},
"workspace": "/srv/research",
"notify_mode": "auto",
"rule": {"days": ["mon"], "times": ["09:00"], "timezone": "UTC"}
}
}
JSON
```
The example is paused. Set `enabled: true` only when those future executions are
intended. Use `{"every":"24h"}` instead of `times` for elapsed intervals; do
not set both. Omit `days` for everyday (`sun` through `sat` are accepted values).
Clock rules handle DST: nonexistent spring-forward times are skipped and repeated
fall-back wall times fire once.
`list_schedules` accepts optional `pipeline_id` and returns `schedules`. Edits use
`save_schedule` with the full returned record and its current positive `id` and
`revision`; a stale revision is refused. `delete_schedule` takes `schedule_id`
and `expected_revision`. Reload and reconcile conflicts rather than overwriting
somebody else's changes.
Use a unique `request_key` for each intentional creation. Reuse it only when
retrying that exact creation after a lost reply: the same payload returns the
same record, a different payload conflicts, and deleted records are not
resurrected. Run dispatch has separate occurrence IDs and atomic provenance.
## Existing embedded schedules
New validate/submit requests reject `# settings` scheduling blocks with guidance
to save a separate schedule. Published historical versions remain readable and
unchanged. Upgrade imports the latest legacy slots into independent records,
preserves cadence/next-due state and old events, and backfills run provenance only
from actual recorded timer events. Legacy workspace defaults bind at execution
server startup, not from an arbitrary offline database reader's directory.
Paused/deleted entries do not reappear on restart. Existing workflow source,
versions and completed work are not rewritten or replayed. Keep a database backup
when upgrading; older binaries do not implement this external scheduling model.