chore(configs)!: rename tasks_per_minute to dispatch_per_minute (#3991)
## What Renames `tasks_per_minute` to `dispatch_per_minute` on `orchestrator`, the `eval` entrypoint and the SFT online `[eval]` block. This uses the same name and wording as #3652. The old name was wrong. The dispatcher takes one rate-limiter token per **episode** it starts (`Dispatcher.acquire`, called once per scheduled episode), not one per task. With `group_size = 8`, `tasks_per_minute = 80` started only 10 tasks per minute. The docstrings now say what is counted: at most N episodes start per minute, and a group counts `group_size` times. Breaking: configs that set `tasks_per_minute` now fail validation (`extra="forbid"`). No shipped config, doc, test or skill sets it or mentions it. ## Overlap #3652 (draft, orchestrator as hook-wired components) makes the same rename. This PR lands it on its own and does not depend on that refactor. ## Test plan - `pytest tests/unit/orchestrator tests/unit/eval tests/unit/test_configs.py -m "not gpu"`: 357 passed. - `ruff check` and `ruff format --check` on the changed files. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Breaking config field rename only; runtime rate limiting behavior is unchanged aside from clearer documentation. > > **Overview** > **Breaking rename:** `tasks_per_minute` → `dispatch_per_minute` on orchestrator config, eval/SFT online eval config (`ServedEvalConfig`), and everywhere it is passed into `Dispatcher` (orchestrator + eval runner). > > The limit semantics are unchanged in code (still `AsyncLimiter` with one token per scheduled episode in `Dispatcher.acquire`), but the name and docstrings now match behavior: the cap is **episodes started per minute**, and a rollout group with `group_size` N consumes N tokens. Configs that still use `tasks_per_minute` will fail validation under `extra="forbid"`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0436304d5e40baed76abfadaa5b989048e818b6a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This commit is contained in:
@@ -28,10 +28,11 @@ class ServedEvalConfig(EvalSourcesConfig):
|
||||
"""Adaptive in-flight episode concurrency, sized by the same controller as
|
||||
``[orchestrator.concurrency]``. Set ``min_inflight = max_inflight`` to pin it."""
|
||||
|
||||
tasks_per_minute: int | None = Field(None, ge=1)
|
||||
"""Global rate limit on episode dispatch, in tasks per minute. Use it for
|
||||
sandbox-backed environments to pace provisioning during autoscaling. None disables
|
||||
rate limiting."""
|
||||
dispatch_per_minute: int | None = Field(None, ge=1)
|
||||
"""Rate limit on episode dispatch: at most this many episodes start per minute. Each
|
||||
episode counts once, so a group of ``group_size`` episodes counts ``group_size``
|
||||
times. Use it for sandbox-backed environments to pace provisioning during
|
||||
autoscaling. None disables it."""
|
||||
|
||||
heartbeat: HeartbeatConfig | None = None
|
||||
"""BetterStack heartbeat for the run: pinged by landed episodes — the first
|
||||
|
||||
@@ -512,8 +512,8 @@ class OrchestratorConfig(BaseConfig):
|
||||
output_dir: Path = Field(default_factory=default_output_dir)
|
||||
"""Directory to write outputs to — checkpoints, weights, rollouts, and logs are written as subdirectories. Shared with the trainer; should be a persistent directory with enough disk space and unique per experiment running on a single node. Defaults to ``$PRL_OUTPUT_DIR`` if set, else ``outputs``."""
|
||||
|
||||
tasks_per_minute: int | None = Field(None, ge=1)
|
||||
"""Global rate limit on task dispatch, in tasks per minute. Recommended for sandbox-backed environments to prevent sandbox-not-ready errors during autoscaling. None disables rate limiting."""
|
||||
dispatch_per_minute: int | None = Field(None, ge=1)
|
||||
"""Rate limit on episode dispatch, shared by train and eval: at most this many episodes start per minute. Each episode counts once, so a group of ``group_size`` episodes counts ``group_size`` times. Recommended for sandbox-backed environments to pace provisioning during autoscaling. None disables it."""
|
||||
|
||||
batch_size: int = Field(128, ge=1)
|
||||
"""Samples to train on per step."""
|
||||
|
||||
@@ -118,7 +118,7 @@ class EvalRunner:
|
||||
progress=None,
|
||||
initial_max_inflight=self.concurrency.max_inflight,
|
||||
max_inflight_ceiling=config.concurrency.max_inflight,
|
||||
tasks_per_minute=config.tasks_per_minute,
|
||||
dispatch_per_minute=config.dispatch_per_minute,
|
||||
max_off_policy_steps=0,
|
||||
run_id=self.run_id,
|
||||
run_name=self.run_name,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
the concurrency controller moves it via ``set_limit``; refills are
|
||||
burst-capped so a raised (or drained) cap never lands all its prefills at
|
||||
once.
|
||||
- Optional rate limiting via ``AsyncLimiter(tasks_per_minute, 60)``.
|
||||
- Optional rate limiting via ``AsyncLimiter(dispatch_per_minute, 60)``, one token per episode.
|
||||
- Every dispatched attempt reaches ``out_q`` exactly once: as the native
|
||||
episode returned by the environment, as a ``DispatchFailure`` when no
|
||||
episode was produced, or under the group's ``GroupCancellation`` when the
|
||||
@@ -139,7 +139,7 @@ class Dispatcher:
|
||||
progress: Progress | None,
|
||||
initial_max_inflight: int,
|
||||
max_inflight_ceiling: int | None,
|
||||
tasks_per_minute: float | None,
|
||||
dispatch_per_minute: float | None,
|
||||
max_off_policy_steps: int,
|
||||
run_id: str,
|
||||
run_name: str | None,
|
||||
@@ -168,7 +168,7 @@ class Dispatcher:
|
||||
self.max_inflight = initial_max_inflight
|
||||
self.current_inflight = 0
|
||||
self.rate_limiter: AsyncLimiter | None = (
|
||||
AsyncLimiter(tasks_per_minute, time_period=60) if tasks_per_minute else None
|
||||
AsyncLimiter(dispatch_per_minute, time_period=60) if dispatch_per_minute else None
|
||||
)
|
||||
# Admission smoothing: the pool may only GROW by ``burst_cap`` per
|
||||
# window. Replacing a completed episode is always free (each natural
|
||||
|
||||
@@ -330,7 +330,7 @@ class Orchestrator:
|
||||
progress=self.progress,
|
||||
initial_max_inflight=self.concurrency.max_inflight,
|
||||
max_inflight_ceiling=config.concurrency.max_inflight,
|
||||
tasks_per_minute=config.tasks_per_minute,
|
||||
dispatch_per_minute=config.dispatch_per_minute,
|
||||
max_off_policy_steps=config.max_off_policy_steps,
|
||||
run_id=self.run_id,
|
||||
run_name=self.run_name,
|
||||
|
||||
Reference in New Issue
Block a user