Running in parallel on Ray¶
Set execution.max_workers above 1 and a study’s tasks, or a fit’s variants,
run on Ray. You can also pass max_workers= in Python or --workers on the
command line.
execution:
max_workers: 8
task_timeout_s: 3600
retries: 1
on_error: continue
Who does what¶
Workers build and solve. The main process stores every result:
prepare, in the main process: check the tag, store the derived spec, and read the spec and its files.
execute, on a worker: build, solve and export. The worker gets only plain data and hook import strings.
finish, in the main process: map the units and store the result.
Workers never get a model, a connection or a credential, and never touch the store. The stored results are the same as when the tasks run one after another in-process. The reasons for this split are in 0001: Running studies on Ray.
Where Ray runs¶
Ray is local unless you give a cluster. Any of these sets one:
execution.ray_addressin the config;Orchestrator(ray_address=...);FLEXORCH_RAY_ADDRESS;--ray-addresson the command line.
A local Ray is started once per process, in the flexorch namespace, and
reused. A Ray that the caller has already connected to is used as it is. A
cluster’s workers need flex-orchestrator and the hooks’ modules installed.
Each worker runs one thread per solver library (OMP_NUM_THREADS=1 and the
like), so max_workers solves don’t oversubscribe the CPUs.
Limits and failures¶
Setting |
Default |
Meaning |
|---|---|---|
|
7200 (2 h) |
A task that runs over is killed and stored as a failed result ( |
|
0 |
How many times a task is run again when building, exporting or solving raises, or its worker dies. A task whose spec or result can’t be stored isn’t retried. |
|
|
|
|
none |
Restart a worker process after this many tasks, to keep memory bounded. |
|
1 CPU |
What each task reserves on Ray ( |