Skip to main content

Methods

A method is a named, reusable sequence of actions. Each action is bound to its own device; the method itself is just the ordered composition. When a method yields an action, the transporter brings the labware to that action's device (if it isn't already there), the action runs, then the next action in the method runs — possibly on a different device.

Defining a method

@orca.method
async def warm_and_shake(ctx: MethodContext):
yield warm # on the warmer
yield shake # on the shaker — transporter moves the plate before this runs

The body is an async generator that yields actions in order. Each yielded action runs in sequence, and actions can target different devices — the transporter handles the moves between them automatically.

Method parameters

@orca.method(failure_policy=FailurePolicy.PAUSE)
async def critical_step(ctx: MethodContext):
yield delicate_action
ParameterDefaultEffect
failure_policyNoneWhat happens if an action raises. None inherits the system-wide policy; PAUSE parks the thread for operator recovery; ABORT kills the thread. See Failure policies.

Custom Python in methods

Methods are async functions — you can write arbitrary Python between yields:

@orca.method
async def conditional_step(ctx: MethodContext):
if some_condition():
yield action_a
yield action_b

You can also access the method context (ctx) for variable lookup and event emission. Both await ctx.param(name) and await ctx.emit(...) are async. ctx.device(name) requires the device name (methods can span devices). There is no wait_for on MethodContext.

See Context API reference for the full MethodContext surface.

Sharing methods across threads

Methods can be reused — define one and yield it from multiple threads:

@orca.method
async def seal_step(ctx: MethodContext):
yield seal

@orca.thread(labware=plate_a, ...)
async def plate_a_journey(ctx: ThreadContext):
yield seal_step

@orca.thread(labware=plate_b, ...)
async def plate_b_journey(ctx: ThreadContext):
yield seal_step # same method, different thread

TODO: shared method semantics — when threads converge on the same method instance vs. each getting its own.

Where to go next

  • Actions — the atomic operations methods are built from.
  • Threads — how methods compose into a thread's journey.