Skip to main content

Methods

Methods group related actions into a sequence that executes at a single device location. Methods can be executed in isolation of the workflow to simplify testing and recovery operations.

MethodTemplate

Import from orca.sdk.workflow:

from orca.sdk.workflow import MethodTemplate
from orca.sdk.actions import Shake, Seal

shake_and_seal = MethodTemplate(
name="shake_and_seal",
actions=[
Shake(resource=shaker, duration=60, speed=500, inputs=[plate], outputs=[plate]),
Seal(resource=sealer, temperature=165, duration=5, inputs=[plate], outputs=[plate]),
]
)

Parameters

ParameterTypeDescription
namestrMethod name
actionsList[ActionTemplate]Actions to execute in sequence
optionsDict[str, Any]Optional configuration (default: {})

Properties

  • name - Method name
  • actions - List of action templates
  • inputs - Union of all action inputs (automatically computed)
  • outputs - Union of all action outputs (automatically computed)

Methods

  • append_action(action) - Add an action to the end
  • add_actions(actions) - Add multiple actions

How Methods Execute

When a thread reaches a method:

  1. Transporter places labware at the method's device
  2. Each action waits for all its inputs to arrive, then executes
  3. Actions execute sequentially in order
  4. All actions complete before the thread continues
Thread arrives at method location


┌─────────────────────────────┐
│ Method: shake_and_seal │
│ ┌───────────────────────┐ │
│ │ Action 1: Shake │──▶ Executes first
│ └───────────────────────┘ │
│ ┌───────────────────────┐ │
│ │ Action 2: Seal │──▶ Executes second
│ └───────────────────────┘ │
└─────────────────────────────┘


Thread continues to next method

SharedMethodTemplate

For operations requiring multiple plates simultaneously (e.g., liquid transfers), use SharedMethodTemplate:

from orca.sdk.workflow import MethodTemplate, SharedMethodTemplate, ThreadTemplate

# The actual method with the multi-plate action
transfer_method = MethodTemplate(
name="transfer",
actions=[
RunProtocol(
resource=liquid_handler,
protocol_filepath="transfer.hsl",
parameters={"volume": 50},
inputs=[source_plate, dest_plate],
outputs=[source_plate, dest_plate]
)
]
)

# Thread 1: Has the actual method
source_thread = ThreadTemplate(
source_plate,
start_location,
end_location,
methods=[transfer_method]
)

# Thread 2: Uses SharedMethodTemplate as placeholder
dest_thread = ThreadTemplate(
dest_plate,
start_location,
end_location,
methods=[SharedMethodTemplate()]
)

SharedMethodTemplate is a placeholder that gets filled with the actual method at workflow execution time. When you use join=True in set_spawn_point, the spawned thread's SharedMethodTemplate receives the same method as the parent thread - both threads then execute that method together with their own labware.

Configure the relationship using spawn points in the workflow:

workflow.set_spawn_point(
spawn_thread=dest_thread,
from_thread=source_thread,
at=transfer_method,
join=True # Both plates must arrive before method executes
)

See Workflows for details on spawn points and join behavior.

Using Methods in Threads

Methods are assigned to threads, which define the labware's journey:

from orca.sdk.workflow import ThreadTemplate

plate_thread = ThreadTemplate(
labware_template=my_plate,
start=input_stack,
end=output_stack,
methods=[method1, method2, method3] # Executes in order
)

Next Steps