File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434from .pytest .parameterize import DefaultParameterIdGenerator
3535from .log_utils .elasticsearch_direct_http_handler import ElasticsearchDirectHttpHandler
3636from .log_utils .rollout_id_filter import RolloutIdFilter
37+ from .log_utils .util import setup_rollout_logging_for_elasticsearch_handler
3738
3839from .types .remote_rollout_processor import (
3940 InitRequest ,
6869__all__ = [
6970 "ElasticsearchDirectHttpHandler" ,
7071 "RolloutIdFilter" ,
72+ "setup_rollout_logging_for_elasticsearch_handler" ,
7173 "DataLoaderConfig" ,
7274 "Status" ,
7375 "RemoteRolloutProcessor" ,
Original file line number Diff line number Diff line change 1+ import os
2+ from eval_protocol .types .remote_rollout_processor import ElasticsearchConfig
3+ from .elasticsearch_direct_http_handler import ElasticsearchDirectHttpHandler
4+
5+
6+ def setup_rollout_logging_for_elasticsearch_handler (
7+ handler : ElasticsearchDirectHttpHandler , rollout_id : str , elastic_search_config : ElasticsearchConfig
8+ ) -> None :
9+ """
10+ Whenever a new subprocess is created, we need to setup the rollout context
11+ for the subprocess. This is useful when implementing your own remote server
12+ for rollout processing.
13+
14+ 1. Set the EP_ROLLOUT_ID environment variable
15+ 2. Configure the Elasticsearch handler with the Elasticsearch config
16+ """
17+
18+ # this should only affect this subprocess so logs from this subprocess can
19+ # be correlated to the rollout
20+ os .environ ["EP_ROLLOUT_ID" ] = rollout_id
21+
22+ handler .configure (elasticsearch_config = elastic_search_config )
You can’t perform that action at this time.
0 commit comments