With ORCA_RUNNER=ec2 the scheduler starts a run's start s as:
- a head instance (
--head-type at registration, else
ORCA_EC2_HEAD_TYPE, on-demand): the dista head, for a pipeline with
tasks, and the driver, <binary> resume <run>, beside it on localhost;
workers worker instances (--worker-type, else
ORCA_EC2_WORKER_TYPE; Spot with --spot), for a pipeline with tasks,
started straight after with DISTA_HEAD at the head's private address.
Each is tagged orca.run, orca.start, orca.pipeline and orca.role,
told to terminate when it shuts down, and started from user data that runs
the pipeline's image (ORCA_EC2_MODE=docker, the default: docker run --network host, after ORCA_EC2_PREAMBLE, such as an ECR login) or the
binary itself (direct, for the tests' stand-in EC2), then shuts down
(ORCA_EC2_SHUTDOWN). The head keeps the driver's output in the run's
driver.log (<binary> keep-log) before it does.
A pipeline registered with --workers MIN..MAX scales: its run starts
MIN workers, which may be none, and every tick scale reads the head's
demand (dista status --json, from port 6390 on the head's private address,
through the pipeline's binary: <binary> dista-status, since dista's
sockets can't share orca's binary with flare's) and asks
dista.scale.decide what to do. It starts the workers asked for,
up to MAX, and drains the ones named with dista drain; a drained worker
exits once its work and results have moved, and its instance's script shuts
it down. ORCA_SCALE_UP_AFTER (5 s), ORCA_SCALE_IDLE (60 s) and
ORCA_SCALE_STEP (4) tune the policy. The budget counts MAX.
A pipeline's secrets (--secret NAME=ID) are read by each instance's
script at start, after the preamble, with aws secretsmanager get-secret-value (ORCA_SECRET_FETCH replaces the command, which is given
the ID), exported as NAME, given to the containers, and named in
ORCA_SECRETS so that every log orca writes masks them.
Every tick, sweep terminates the instances of runs that aren't running at
that start, and those older than ORCA_RUN_DEADLINE (a day). Instances get
ORCA_EC2_DATABASE_URL as ORCA_DATABASE_URL (the control instance's
private address), the warehouse, the logs, the region and the scheduler's
variables named in ORCA_RUN_ENV; ORCA_EC2_AMI, ORCA_EC2_SUBNET,
ORCA_EC2_SECURITY_GROUP and ORCA_EC2_PROFILE say where and as what they
run. cpu_millis is a run's instances' vCPUs, which the scheduler checks
against ORCA_VCPU_BUDGET first.