Skip to content

Concepts ​

These pages use one word for each object. The table is the list. A later page does not introduce a second word for the same object.

WordMeaning
stepA named Go function. The function returns a value and an error.
actionA named Go function. The function returns only an error.
workflowA definition of a DAG. You build it with Define or DefineResult.
runOne execution of a step, an action, or a workflow. The run is a row.
standalone jobA run with one node. You start it with Enqueue.
nodeOne step or one action inside a run.
futureThe typed output of a node. You pass a future to the next Do.
handlerThe Go function that a worker calls for a step or an action.
clientThe value that New returns.
workerA client that calls handlers. You start it with Start.
producerA client with no handlers. Start returns ErrProducerOnly.
resultThe typed output of a completed run. Result waits and returns it.
scheduleA row that starts runs from a cron specification.
signalA named payload that you send to a waiting run.
queueA name that selects which workers claim a step.
leaseThe interval during which one worker owns a running step.
attemptOne call of a handler that counts against the attempt limit.
reclaimA new claim after a lease expires. A reclaim is not an attempt.

Do not use "task", "pipeline", or "promise" for these objects. "Job" means a standalone job. A workflow execution is a run.

Three calls ​

You declare the work. You submit the work. You read the run.

go
fetch := cyclone.NewStep("fetch", fetchPage)
save := cyclone.NewStep("save", savePage)

ingest := cyclone.DefineResult("ingest",
    func(b *cyclone.Builder, url string) (*cyclone.Future[Receipt], error) {
        page := fetch.Do(b, cyclone.Lit(url))
        return save.Do(b, page), nil
    })

run, err := ingest.Submit(ctx, client, url)
receipt, err := run.Result(ctx)

Do does not call the handler. Do adds a node to the graph. The worker calls the handler later.

A future has no method that blocks inside the builder. An if in the builder can read the submit input. An if cannot read the future value. That value does not exist yet.

Result, Wait, and Output ​

MethodWaitsReturns
ResultYesThe output. A failed or cancelled run returns an error that matches ErrRunNotCompleted.
WaitYesThe terminal status. A failed run is not an error. Read State.
OutputNoThe output of a completed run. Any other state returns an error.

A cancel of the context stops Result or Wait. The run continues.

What stays fixed ​

The builder writes the graph at submit time. Cyclone inserts the run and every node in one transaction. You cannot add a node to that run later.

Two nodes can grow after submit, and the node itself is still fixed:

  • ForEach adds one item task for each element of an upstream list.
  • Child starts a second run. The child builder runs when the child input exists.

Order in the builder does not create an edge. A future input creates a data edge. After creates an order edge. Nodes with no edge can proceed together.

Where state is ​

Postgres holds the run. The worker does not. A worker claims a row, calls the handler, and writes the result. If the process stops, the lease expires and another worker can claim the step.

CompletionTx is a transaction that commits with the step. A write on that transaction commits with the completion, or it rolls back with the completion.

Next ​

Cyclone stores each run in Postgres.