Skip to content

Commit 3e4d8b7

Browse files
author
Dylan Huang
committed
Implement rollout status handling in rollout processor; add helper function to preserve error status during updates.
1 parent 26c45e0 commit 3e4d8b7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

eval_protocol/pytest/utils.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,16 @@ def deep_update_dict(base: dict[str, Any], override: dict[str, Any]) -> dict[str
312312
return base
313313

314314

315+
def _set_rollout_status_to_finished(result: EvaluationRow) -> None:
316+
# Only set to finished if execution finished while not
317+
# updating status itself. In the case that the rollout
318+
# processor set the status to an error, we want to
319+
# preserve the error so we do nothing in this case.
320+
# test_remote_fireworks_propagate_status.py verifies this.
321+
if result.rollout_status.is_running():
322+
result.rollout_status = Status.rollout_finished()
323+
324+
315325
async def rollout_processor_with_retry(
316326
rollout_processor: RolloutProcessor,
317327
fresh_dataset: list[EvaluationRow],
@@ -359,7 +369,9 @@ async def execute_row_with_backoff(task: asyncio.Task[EvaluationRow], row: Evalu
359369
try:
360370
# Try original task first
361371
result = await task # pyright: ignore[reportUnknownVariableType]
362-
result.rollout_status = Status.rollout_finished()
372+
373+
_set_rollout_status_to_finished(result)
374+
363375
return result # pyright: ignore[reportUnknownVariableType]
364376
except Exception as e:
365377
# NOTE: we perform these checks because we don't put the backoff decorator on initial batch call. we don't want to retry whole batch if anything fails.
@@ -372,7 +384,9 @@ async def execute_row_with_backoff(task: asyncio.Task[EvaluationRow], row: Evalu
372384
# Use shared backoff function for retryable exceptions
373385
try:
374386
result = await execute_row_with_backoff_retry(row)
375-
result.rollout_status = Status.rollout_finished()
387+
388+
_set_rollout_status_to_finished(result)
389+
376390
return result
377391
except Exception as retry_error:
378392
# Backoff gave up

0 commit comments

Comments
 (0)