Aller au contenu
Developer Preview — APIs and language features may change before 1.0

schedules

Ce contenu n’est pas encore disponible dans votre langue.

schedules

Block: time-based triggers — run this machine on a schedule (cron-like)

Translations

  • es: programa
  • fr: programme
  • en: schedules
  • de: plant
  • ja: 定期実行
  • zh: 定时任务定期
  • ko: 스케줄

Example — Loops, schedules and parallel work

Builds a daily digest: runs on a schedule, works through a list, does two things at once, repeats until done, starts another machine and waits for an answer.

machine daily_digest
accepts
urls as list of text, is required
responds with
summary as text
implements
runtime
timeout: 5000
lifecycle
on_start: warm
schedules
daily: "07:00"
run gather
go to deliver
flows
flow gather
for each url in input.urls
accumulate pages from []
compute fetch_one
{page: url}
together
compute part_a
{x: 1}
compute part_b
{y: 2}
while steps.part_a.x < 3
compute bump
{x: steps.part_a.x + 1}
until steps.bump.x > 2
compute retry_bump
{x: steps.bump.x + 1}
flow deliver
match input.urls
when []
{summary: "nothing to send"}
otherwise
{summary: "digest ready"}
launch notifier
target: mail_service
wait for approval
event: "digest.approved"
publish "digest.sent"
on failure
compute recover
{summary: "failed"}