Magpie on Ray architecture#
2026-07-17
2 min read time
Magpie’s Ray integration offloads analyze, compare, and benchmark workloads from the machine running the CLI or MCP server onto GPU-capable worker nodes in a Ray cluster, without changing the evaluation logic itself. The integration is built around a driver-worker split: the driver process submits a remote function through RayJobExecutor, and the worker node executes the same AnalyzeMode, CompareMode, or BenchmarkMode code it would run locally. This page describes how executor selection works, how the task flows end-to-end, and where to find the relevant source files.
Magpie’s Ray integration follows a driver-worker model where the driver submits tasks and workers execute them on GPU-capable nodes.
Driver vs worker#
Magpie’s Ray integration uses two roles: the driver process that submits work, and the worker nodes that execute it.
Driver: process running
python -m Magpie …, MCP, or your script. It callsSchedulerorBenchmarkMode, connects withray.init(address=…), and submits a remote function.Worker: Ray executes
Magpie.remote.tasks.run_taskon a GPU-capable node. That function dispatches to_run_analyze,_run_compare, or_run_benchmark.
Executor selection#
The executor is chosen based on SchedulerConfig.environment_type.
|
Executor |
Execution |
|---|---|---|
|
|
Subprocesses on the driver machine ( |
|
Container executor |
Isolated environment on the driver (kernel flows). |
|
|
|
Benchmark mode additionally uses BenchmarkConfig.run_mode: docker, local, or ray. When run_mode is ray, BenchmarkMode builds a Task and uses RayJobExecutor internally (Magpie/modes/benchmark/benchmarker.py).
End-to-end flow#
flowchart LR
subgraph Driver
CLI[MCP / CLI]
SCH[Scheduler or BenchmarkMode]
RJE[RayJobExecutor]
CLI --> SCH --> RJE
end
subgraph Cluster
RT[run_task]
A[AnalyzeMode]
C[CompareMode]
B[BenchmarkMode]
RJE -->|ray.remote| RT
RT --> A
RT --> C
RT --> B
end