forked from eval-protocol/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
22 lines (17 loc) · 890 Bytes
/
Copy pathutil.py
File metadata and controls
22 lines (17 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
from eval_protocol.types.remote_rollout_processor import ElasticsearchConfig
from .elasticsearch_direct_http_handler import ElasticsearchDirectHttpHandler
def setup_rollout_logging_for_elasticsearch_handler(
handler: ElasticsearchDirectHttpHandler, rollout_id: str, elastic_search_config: ElasticsearchConfig
) -> None:
"""
Whenever a new subprocess is created, we need to setup the rollout context
for the subprocess. This is useful when implementing your own remote server
for rollout processing.
1. Set the EP_ROLLOUT_ID environment variable
2. Configure the Elasticsearch handler with the Elasticsearch config
"""
# this should only affect this subprocess so logs from this subprocess can
# be correlated to the rollout
os.environ["EP_ROLLOUT_ID"] = rollout_id
handler.configure(elasticsearch_config=elastic_search_config)