SDK quick reference
One line per feature: what it does when a workflow runs. Read it before you write a workflow.
Errors and recovery
Nothing ends a run without the operator. An error pauses the thread that hit it, the rest of the run keeps going, and the operator picks a decision from the thread's honoured_decisions. Where the thread stopped (pause_site) decides which decisions apply; see Recovery.
RETRYrepeats only the step that failed: the device call, the wait, the move, the spawn. It is the default.RETRY_ACTIONre-runs the whole action from the top. It applies only where the action's own Python failed (a divide by zero, a missing key), because then no smaller step failed.CONTINUEsays a person dealt with it; the run goes on to the next action.ABORT_ACTION,ABORT_METHOD,ABORT_THREADdiscard the action, the method, or the thread.- A crash the thread's own handling did not catch pauses at
UNHANDLED_ERROR, which honoursABORT_THREADonly, because the failed step is unknown. A starting thread that crashes pauses at once; its siblings keep working. action(failure_policy=ABORT)opts out: an error in that action fails the thread instead of pausing it.PAUSEis the default.- A run where the operator aborted some threads and at least one other completed reports
partial_completed. It reportsabortedonly when it was stopped or nothing completed, andfailedwhen a thread failed.
ctx commands inside an action
| Call | What happens |
|---|---|
ctx.device() / ctx.device(Type) | Commands go to the device the action declared, and no other. |
ctx.labware, ctx.plate, ctx.tip_rack, ctx.trough | The exact instance this thread holds. Two plates of one template in a run each get their own. |
ctx.next_tips(name, count) | The next count spots that hold a tip; never the same spot twice. The rack's record drops as soon as the pick returns. |
ctx.get_well_selector(name) | The selector from action(well_selectors=), or all wells. Device commands touch only those wells. WellSelector, well_list, well_range, quadrant and all_wells import from orca.sdk.wells. |
ctx.pool_index(receiver) | 0 for the first contributor to a receiver, then 1, 2, ... Use it to put each contributor in its own region. |
ctx.param(name) | The submitted value, else the default. A value changed during the run is seen by every later call. |
ctx.emit(event, value, data) | Reaches other threads' wait_for, and the event stream as CUSTOM.<name>.EMITTED. An event name is letters, digits, _ and -; any other name is refused at the call. orca.on and orca.branch refuse it when the thread reaches that step, which pauses the thread. |
ctx.wait_for(event, timeout) | Waits for the event; an earlier emit is kept and returns at once. A timeout pauses at ACTION_WAIT, and RETRY waits again without re-running the rest of the action. |
ctx.manual_step(instruction, timeout_hours) | Emits OPERATOR.INSTRUCTION; nothing after it runs until that step is confirmed, in SIM and LIVE. A timeout pauses at ACTION_WAIT; the step stays pending, and RETRY waits for the confirm again. |
ctx.has_more_work() | In a receiver's loop: True while any thread feeding it, directly or further up, is live. |
Workflow builder and capacity
| Feature | What happens |
|---|---|
wf.start(thread) | The thread starts with the run. |
wf.thread(thread, capacity=CapacityPolicy(max_contributions=N)) | Up to N contributors feed one receiver. The next contributor gets a new receiver at once, while the full one runs its later steps. |
overflow_action=REJECT | The contributor that finds the slot full, while the full receiver still runs, pauses, and SLOT.<key>.REJECTED is emitted. The rest of the run goes on. RETRY tries again once capacity frees; ABORT_THREAD ends only that contributor. |
overflow_strategy=SequentialStashStrategy() | The contributor that finds the slot full waits, and SLOT.<key>.OVERFLOW is emitted. When the receiver ends, a new receiver serves the waiting contributors in the order they arrived. SequentialStashStrategy, RejectStrategy and IOverflowStrategy import from orca.sdk.workflow. |
can_continue_fn | When it returns False for the current receiver, the next contributor gets a new receiver, even below max_contributions. |
wf.on(event, handler) | The handler runs once per firing of that event, and not for other events. It takes a whole event such as ACTION.COMPLETED or CUSTOM.qc_done.EMITTED: its dots are allowed, no part may be empty, and the name in CUSTOM.<name>.EMITTED follows the event-name rule. A bad one fails the build. |
A receiver takes contributions until its has_more_work() turns False. Under the default NEW, a full or used-up receiver hands its slot on at that moment and keeps running its later steps, so the next contributor never waits for them. REJECT and an attached overflow_strategy keep one receiver per slot until it ends; they act on a contributor that arrives while the full receiver is still running.
Thread options and steps
| Feature | What happens |
|---|---|
thread(contributes_to=[receiver]) | Its transfers land on the receiver's record, and the receiver stays open until it ends. |
orca.join(method, allows=) | Contributors join the shared method, which runs once for all of them. A joined plate goes only to the actions that take it as an input. |
thread(required=False) | The thread spawns only for a group that names it. A group that leaves it out runs to the end without it. |
thread(immovable=True) | The plate never moves. Another thread that needs its site pauses at once with UnresolvableDeadlockError. |
action(tag=) | The tag is on every operation record of that action. |
orca.park(spot or list) | The thread waits at the spot; with a list, concurrent threads take different spots. |
orca.on(event, timeout) | The thread waits for the event. A timeout pauses at WAIT_EVENT_TIMEOUT; RETRY waits again. |
orca.branch(event, {value: [...], "else": [...]}) | Only the methods for the emitted value run; an unlisted value runs "else". |
action(deck_positions=) | Each labware sits at the named deck slot, and the command names it. |
action(declares=DeclaredTracking(...)) | The plate's record changes as declared after the action. |
Start and end kinds
| Kind | What happens |
|---|---|
MANUAL_PLACE (start, default) | SIM places the plate itself. LIVE waits at AWAITING_MANUAL_PLACE until the plate is registered there. |
DISPENSE (start) | The source's dispense runs, then the plate is recorded at the location. |
REUSE_EXISTING (start) | Binds the plate already there, the same instance across runs. |
MANUAL_REMOVE (end, default) | LIVE waits at AWAITING_MANUAL_REMOVE until the plate is discharged. SIM takes the plate off the record at its end; its history stays readable. |
LEAVE_IN_PLACE (end) | The plate stays recorded there after the run, with its volumes. |
end=[spots] | Concurrent plates end on different spots. |
Labware, devices, submissions
initial_state=LabwareInitialState(...): each new plate's record starts with those volumes or tips.- A method run on its own (
orca method execute) keeps the start and end kinds its workflow gives each labware, so a plate the workflow leaves in place stays on the deck. PlateTemplate(with_lid=True)is refused when the workflow is built. Lids are not supported yet.ResourcePool: each step runs on one free pool device, and the record names which. A busy device is never chosen; with every device busy the step waits.PlateHotel: a plate on a shelf is recorded at<hotel>/shelf_<n>; two plates never share a shelf.- A gripper holds at most one plate. While it carries a plate, the plate is recorded in the gripper and nowhere else.
GroupSharing.SHARED_ACROSS_GROUPSwith one submission: every group feeds one plate.SubmissionBatching.BATCHABLEwithbatch_mode="JOIN_EXISTING": a later submission feeds the plate of the run still accepting. Both need the matching field on the submission; see Submissions.- A named plate standing on another thread's start is accepted only if its own start will be free; two named plates on each other's starts are refused at submit.