PYX

Task Lifecycle in Console

Status transitions and operational behavior for running tasks.

Task statuses

Common statuses you will see:

  • running - task is fully active, strategy inputs are live, and buys/sells are allowed
  • paused - full freeze; open orders are canceled, task-specific external inputs are unsubscribed, and the task can be resumed
  • draining - wind-down mode; buys are blocked, but sells, order updates, exchange events, and resolution handling stay active until the task is flat
  • stopped - fully torn down and removed from the active runtime; not resumable
  • error - task hit a runtime or restart failure and could not continue normally

Controls

From task pages, you can:

  • Resume a paused task (paused -> running)
  • Pause a running task (running -> paused)
  • Drain a running or paused task (running -> draining or paused -> draining)
  • Force-stop a task

Use pause for a temporary freeze. For script tasks, VM state is preserved, so resume continues from the same in-memory state.

Use drain for the normal "stop when flat" flow. While a task is draining, it cannot open new exposure, but it can continue reducing or resolving existing exposure. The task automatically transitions to stopped once there are no active positions and no active or in-flight orders.

Use stop as a force-stop. It is no longer a passive status change: it closes open positions at market, then fully stops and removes the task.

Automatic error stop

If a script task hits 5 errors within 10 seconds:

  • Task status is set to error
  • Open orders are canceled on a best-effort basis

This prevents repeated failing execution loops and is distinct from user-triggered drain or force-stop.

On this page