genroc

docs / Guides / Operating

Managing instances

Learn how to manage running instancess.

Instances are essentialy a state machines. When you run the process, it validates the input data and stores the initial state is created.

Then the process is picked up by a worker which advances the instance into a new state.

Instance lifecycle

Genroc instances communicate their lifecycle by status field.

Instance status transitions live settled start pause task ends resume child failed child failed end reached raise error children settle cancel task ends retry running pausing paused failing cancelling completed raised failed cancelled genctl command engine

Settled marks a terminal state: no work moves and nothing advances out of it. Accepts a result is whether a worker’s answer to an external task is still delivered — a pause suspends execution, not delivery.

StatusSettledAccepts a resultMeans
runningnoyesadvancing, or waiting on a timer, a child or an external task
pausingnoyesa pause was requested while a task was in flight; it settles at the next task boundary
pausednoyesnot being advanced, and able to resume exactly where it stopped; timers keep running
failingnonodoomed by an error, and draining the descendants still in flight
cancellingnonoa cancel was requested while a task was in flight; it settles at the next task boundary
completedyesnofinished by reaching the end of its definition
failedyesnostopped by an error; retryable, which is what separates it from the other settled outcomes
raisedyesnoconcluded by a raise clause — a condition, not a defect, and catchable by the parent
cancelledyesnostopped for good by an operator — terminal, and unlike a pause there is no way back

You have four commands to your disposal pause, resume, cancel and retry. If the instance has children, the commands must target the root process not to the children separately.

Pause (and resume)

genctl pause @last

This will pause the instance if it’s running. The instance can then be resumed by resume command with the same syntax.

The pause command will wait for the running workers with pausing status, so no worker is forcefully interrupted and no work is repeated.

Pause/resume operates strictly within the definition boundaries (they never do extra retry), so you can use them as you like without changing the instance behavior. Only caveat is that timers keep running even when the instance is paused, so if there is a timeout (e.g. on external task) it can run out while the instance is paused.

An external worker can still deliver result through resolve. Even if the instance switched to paused status.

Cancel

genctl cancel @last

Will cancel the instnace terminally - it is not possible to resume cancelled instance.

The cancel state also has cancelling as a transitioning instance.

An external worker can’t deliver result through resolve (it will fail), if the instance was cancelled while the worker was running.

Retry

genctl retry @last

Retries failed instance, it basically adds one extra retry attempt on the current task.

Retry can’t be used on cancelled or raised statuses.

If the task is only_once, the retry needs to be used with --force flag - it’s because with retry you could easily break only_once rule by accident.

Info about the instance

To check current state of an instance use get command.

> genctl get @last
ID:       006y1m7d
Process:  hello@v1
Status:   completed
Task:     greet
Created:  2026-09-30 12:53:58  (just now)
Updated:  2026-09-30 12:53:58  (just now)

Output:
at: "2026-09-30T10:53:58.669Z"
greeting: hello, world

The example shows us an instance which is compleded which is indicated by status.

The output can also contain Phase, Error, Code and Error data. These are listed only if they contain any value.

Task

The task field tells you what task is being/going to be performed. If the instance is terminated it tells you which was the last task.

Phase

Some tasks are not atomic (external/children), meaning the engine needs to perform multiple “ticks” per task.

In that case the phase field is used to distinguish between the sub-states. It is shown only when it’s not empty and it has following meaning:

PhaseMeaning
childrenChild instances were spawned; the parent is blocked until all of them finish.
collectingAll children have finished; the engine still has to merge their outputs into the parent.
externalParked on an external task, waiting for an answer or for its timeout.

Error, Code and Error data

Describes an error if the status is raised or failed. System error codes have ”.” inside (e.g. result.invalid), user defined can’t contain the dot.

Check the task error reference.

Output

This is a public process output. It’s available once the instance is completed and the output is defined in the process.

Process detail

If you want more info about running instance, you can use detail command.

It prints everything that get, but there is extra info about the internal state.

> genctl detail 3kjfx4vm
ID:       3kjfx4vm
Process:  hello@v1
Status:   completed
Task:     greet
Created:  2026-09-25 18:37:52  (4d ago)
Updated:  2026-09-25 18:37:53  (4d ago)
Epochs:   lease 2, task 0, parent task 0, external claim 0

Output:
at: "2026-09-25T16:37:53.073Z"
greeting: hello, world

Children:
greet: 02pcayvt

State:
input:
  who: world
last_error: null
outputs:
  greet:
    at: "2026-09-25T16:37:53.073Z"
    greeting: hello, world
FieldMeaning
ParentThe parent instance and the task that spawned it. Children only.
Call stackEvery ancestor instance, root first. Children only.
Wake atWhen a pending timer fires - a delay, a retry backoff or a timeout.
LeaseThe engine worker advancing the instance and how long it has left, or that the lease expired.
ExternalWhile parked on an external task: unclaimed, claimed by …, or that the claim expired.
EpochsCounters that keep a stale worker or an old answer from overwriting newer work. For debugging.
ChildrenThe spawned instances, keyed by the task that spawned them.
Stateinput, each task’s output under outputs, and last_error - the error last caught by on_error.

Only Epochs is always shown; the rest appear when they have a value.