comptime Square = Task[Int, Int, square]
comptime TaxiTasks = Tasks[Square]
comptime Taxi = Pipeline["taxi", Download, Load, tasks=TaxiTasks]
def load(mut ctx: Ctx, raw: RawFile) raises -> Loaded:
ref rt = ctx.runtime[TaxiTasks]()
var r = rt.remote[Square](7)
...
A run of a pipeline with tasks starts one dista Runtime before its first
step and keeps it until the run ends: in local mode it forks a head and
ORCA_WORKERS workers (default 4); with DISTA_HEAD set it joins that
cluster instead. The same binary is dista's worker: run with DISTA_ROLE
set, orca_main hands the process to dista before reading its arguments.
The runtime starts before orca opens a database connection or its heartbeat
thread, so the forked head and workers inherit neither.
A driver or worker given DISTA_HEAD first waits until the head accepts a
connection (wait_for_head), trying for a second at a time. On Kubernetes
the head's Service can be a moment old: a connection sent before the node
routes its address waits on a connection-tracking entry that never routes,
for minutes, and dista connects without a timeout. A fresh try each second
gets a fresh entry.