Skip to main content

Threads

A thread represents one piece of labware's journey through your system.

ThreadTemplate

Import from orca.sdk.workflow:

from orca.sdk.workflow import ThreadTemplate

plate_thread = ThreadTemplate(
labware_template=sample_plate,
start=input_stack,
end=output_stack,
methods=[dispense_method, seal_method, read_method]
)

Parameters

ParameterTypeDescription
labware_templateLabwareTemplateThe labware this thread processes
startLocationWhere the labware starts
endLocationWhere the labware ends
methodsList[IMethodTemplate]Methods to execute in order (default: [])

Properties

  • name - Thread name (derived from labware template name)
  • labware_template - The labware template
  • start_location - Starting location
  • end_location - Ending location
  • method_resolvers - List of method templates

Methods

  • add_method(method) - Add a method to the end
  • add_methods(methods) - Add multiple methods

Thread Execution

When a thread runs:

  1. Labware starts at the start location
  2. For each method:
    • Transporter picks labware from current location
    • Transporter places labware at method's device
    • All actions in the method execute
  3. Transporter moves labware to end location
Thread: sample_plate


┌─────────────────────────┐
│ Start: input_stack │
└───────────┬─────────────┘
│ pick

┌─────────────────────────┐
│ Method 1: dispense │ ◀── place, execute, pick
└───────────┬─────────────┘


┌─────────────────────────┐
│ Method 2: seal │ ◀── place, execute, pick
└───────────┬─────────────┘


┌─────────────────────────┐
│ Method 3: read │ ◀── place, execute, pick
└───────────┬─────────────┘
│ place

┌─────────────────────────┐
│ End: output_stack │
└─────────────────────────┘

Parallel Threads

Multiple threads run concurrently. Each thread processes its own labware independently:

Thread A: ───[dispense]───[seal]───[read]────────────▶
Thread B: ─────────[dispense]───[seal]───[read]──────▶
Thread C: ───────────────[dispense]───[seal]───[read]▶

The scheduler coordinates resource access. If two threads need the same device, one waits.

Locations

Locations are named positions in your system. Get locations from the SystemMap:

from orca.sdk.system import SystemMap

system_map = SystemMap(registry)
system_map.assign_resources({
"input_stack": storage_device,
"output_stack": storage_device,
"shaker": shaker,
})

input_stack = system_map.get_location("input_stack")
output_stack = system_map.get_location("output_stack")

Location names correspond to teachpoint names in your transporter configuration.

Example: Complete Thread Setup

from orca.sdk.labware import PlateTemplate
from orca.sdk.workflow import MethodTemplate, ThreadTemplate
from orca.sdk.actions import Shake, Seal

# Define labware
sample_plate = PlateTemplate("sample_plate", plate_factory, None)

# Define methods
shake_method = MethodTemplate("shake", [
Shake(resource=shaker, duration=60, speed=500, inputs=[sample_plate], outputs=[sample_plate])
])

seal_method = MethodTemplate("seal", [
Seal(resource=sealer, temperature=165, duration=5, inputs=[sample_plate], outputs=[sample_plate])
])

# Define thread
plate_thread = ThreadTemplate(
labware_template=sample_plate,
start=system_map.get_location("input_stack"),
end=system_map.get_location("output_stack"),
methods=[shake_method, seal_method]
)

Next Steps