Skip to main content
Version: 3.0.0

Runtime

The runtime is the long-lived service that runs your lab. It runs inside the Orca daemon. You start the daemon once, mount your package, and submit workflows as you need them. The runtime runs them side by side against the same instruments.

A package cannot be run from a Python script on its own. It runs on the daemon, and you reach the daemon through the CLI, REST or the Python client.

Start it and run a workflow​

Run these in your package folder:

orca start
orca topology mount
orca run my_first_workflow --run-mode CHECK_RUN --wait
  • orca start starts the daemon in the background on 127.0.0.1. --port fixes the port; without it a free one is picked. The daemon's package folder is the folder it was started in, or ORCA_PACKAGE_DIR.
  • orca topology mount builds the package and starts the runtime.
  • orca run submits a workflow by name. --run-mode is required on every run. See Run modes.

orca status says whether a package is mounted. orca shutdown stops the daemon. orca unload drops the mounted package and leaves the daemon running.

Build from a deployment package​

The daemon builds one folder:

my_lab/
topology.py # build_topology(), optional SYSTEM_NAME and SYSTEM_DESCRIPTION
workflows/
my_first_workflow.py # build_workflow(topology)
...setup files

orca topology mount calls build_topology(), then build_workflow(topology) in every file under workflows/, and registers each workflow under its @orca.workflow(name=...). The setup files (teachpoints, deck layouts, device setups) are listed in Where state lives.

To pick up an edited or new file, run:

orca runtime reload --reason "added the wash step"

It shuts the runtime down and builds it again from the files on disk. It is refused while a run or a check run is active. If the build fails, orca runtime status shows the error.

The examples in the Orca repository are package folders. Any of them runs with the same three commands.

Upgrading a package from 2.3.0​

Orca 3.0.0 changes how a package is written and run.

  1. Change def build_topology(stores) to def build_topology().
  2. Move every Teachpoint(...), deck layout and AccessConfig(...) out of topology.py into teachpoints/<device>.json, deck_layouts/<device>.json and access_configs.json. Transporter("arm") and Translator("bridge") take only a name. LiquidHandler keeps deck_layout="default" as a name. The example packages show each file format.
  3. Remove sim_override=, SIM_DRIVERS and any runner script. SystemRuntime(...), build_system(...) and InMemoryRuntimeStoreFactory are not user calls any more.
  4. Import from orca.orca and orca.sdk.* only: orca.sdk.devices, orca.sdk.labware, orca.sdk.workflow, orca.sdk.build, orca.sdk.runtime, orca.sdk.events, orca.sdk.client.
  5. Rename run modes: PURE_SIM is CHECK_RUN, DEVICE_SIM is SIM.
  6. Rename pacing: --time-scale and sim_time_scale are --sim-speedup and sim_speedup, and the meaning is inverted. 10 is ten times faster.
  7. Move each device out of orca-client's config.json into devices/<name>.json in the package. See orca-client.
  8. Add /api in front of every REST path except /health and /shutdown. Replace the SSE stream with the /ws/events WebSocket.
  9. Recovery decisions: RETRY now repeats only the failed step. Re-running the whole action is RETRY_ACTION (retry-action on the CLI). RETRY_OP and retry-op are gone. A client that sends "RETRY" now gets the step, not the whole action.
  10. Install Orca 3.0.0, cheshire-drivers 2.0.0 and orca-client 2.0.0 together. Older and newer parts refuse each other.

There is no data to migrate. Orca 2.3.0 kept nothing on disk that 3.0.0 reads.

Workflow code now has value limits that used to apply only to operator commands. A shake speed must be above 0 and at most 2000 RPM, a centrifuge g above 0 and at most 5000, a seal temperature 0 to 200, and durations above 0.

Submitting more work​

Submit as many runs as you like while the runtime is up:

orca run my_first_workflow --run-mode SIM
orca submission submit my_first_workflow --run-mode SIM --groups-json '[...]'

orca run returns as soon as the run is accepted unless you pass --wait. For submissions that carry several labware groups, or that join a run already going, see Submissions.

A SIM or LIVE run brings up every device and transporter before it is accepted. If one does not come up the run is refused with devices_not_ready.

The three states​

StateWhat it means
CREATEDThe runtime is built. No work runs yet.
RUNNINGSubmissions are accepted and runs can run. This is the state after a mount.
STOPPEDThe runtime was shut down.

When it starts, the runtime puts every plate on record back at its recorded location, so it resumes from the state it stopped with.

Pausing, resuming, recovering​

When something goes wrong, the runtime pauses the affected labware thread and records an incident. An operator reads the incident and answers with a recovery decision:

orca execution thread pause <execution_id> <thread_id>
orca execution thread resume <execution_id> <thread_id>
orca execution thread recover <execution_id> <thread_id> retry

Pause or resume the whole run:

orca execution pause <execution_id> --reason "checking the sealer"
orca execution resume <execution_id>

A pause holds between instrument commands. The command in progress finishes first. Threads spawned after a pause start paused.

See Recovery for each decision and CLI: recover for the commands.

Watching a run​

orca execution list
orca execution detail <execution_id>
orca execution threads <execution_id>
orca events list --execution <execution_id>
orca intervention next

orca intervention next waits for the next thing that needs a person: a manual place, a manual remove, a manual step, an incident or a device fault. See Events for the live event feed.

Advanced​

What is stopping the run​

Recovery state lives in several places: a thread's pause, a device fault, a paused run, a reservation nobody will release, a wait for a person. Clearing one says nothing about the rest.

orca --json runtime status

The JSON answer carries blockers: one list of everything stopping the run, worst first. It is worked out on every read. GET /api/runtime/status returns the same. Each blocker names its kind (DEVICE_FAULT, DEVICE_EXTERNAL_CONTROL, THREAD_ERROR_PAUSE, EXECUTION_PAUSED, WAITING_ON_A_PARKED_HOLDER, MANUAL_PLACE, MANUAL_REMOVE, MANUAL_STEP, RUNTIME_NOT_BUILT), a severity, a headline, and the remedies that clear it. Many write commands return the same list.

An unacknowledged incident is not a blocker. It is the record of one.

The companion read is orca state unsettled, which lists what the record cannot answer. See State.

Stall detection​

A wait for partner labware has no time limit, because a partner thread may run a multi-hour action before it can move its labware. So the runtime asks a different question: is every live thread blocked, with none doing anything?

When the same blocked shape holds for several checks in a row, the runtime records a SYSTEM_STALL incident and pauses the run. The run stays paused and recoverable. A slow but healthy run never trips it, because any thread that is acting resets the count.

Shutdown​

orca shutdown is an abort. It ends every live run, waits for the threads to stop, saves the incidents and run records it had queued, and then closes. It does not wait for work to finish.

What the runtime keeps​

Plates, runs, incidents, events and audit rows are in <package>/.orca/state.db and survive a restart. A run that was in progress does not continue after a restart. See Where state lives.

Four ways to reach the runtime​

SurfaceHowBest for
orca CLIInstalled with Orca. Talks to the local daemon. See CLI.Operators, scripts, looking around.
RESTEvery route is under /api on http://127.0.0.1:<port>, except GET /health and POST /shutdown. The daemon serves its OpenAPI page at /docs.Local tools and UIs.
WebSocket/ws/events streams events as they happen.Live displays.
Python clientorca.sdk.client.DaemonLoadingClient and OrcaClient.Lab scripts.

Every error has one body: {"detail": {"code": ..., "message": ..., "extras": ...}}.

from orca.sdk.client import ControlPlaneError, DaemonLoadingClient

client = DaemonLoadingClient("http://127.0.0.1:8765")
client.mount_package()
try:
run = client.submit_workflow("my_first_workflow", run_mode="CHECK_RUN")
except ControlPlaneError as error:
print(error)

The daemon has no authentication and listens on 127.0.0.1 only. Run it on a computer only your operators use.

See also​