-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathrollout_processor.py
More file actions
28 lines (21 loc) · 903 Bytes
/
rollout_processor.py
File metadata and controls
28 lines (21 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import asyncio
from abc import ABC, abstractmethod
from eval_protocol.models import EvaluationRow
from eval_protocol.pytest.types import RolloutProcessorConfig
class RolloutProcessor(ABC):
"""
Abstract base class for all rollout processor strategies.
"""
def setup(self) -> None:
"""Setup resources. Override in subclasses if setup is needed. Executed once per invocation."""
pass
@abstractmethod
def __call__(self, rows: list[EvaluationRow], config: RolloutProcessorConfig) -> list[asyncio.Task[EvaluationRow]]:
"""Process evaluation rows and return async tasks. Must be implemented by subclasses."""
pass
async def acleanup(self) -> None:
"""Async cleanup - preferred when you can await."""
pass
def cleanup(self) -> None:
"""Cleanup resources. Override in subclasses if cleanup is needed."""
pass