@@ -121,43 +121,23 @@ async def _process_row(row: EvaluationRow) -> EvaluationRow:
121121 deadline = time .time () + timeout_seconds
122122
123123 while time .time () < deadline :
124- # Poll status (run in thread to avoid blocking event loop)
125- status_result = await asyncio .to_thread (
126- self ._tracing_adapter .get_status , rollout_id = row .execution_metadata .rollout_id
124+ session = self ._get_or_create_session ()
125+ status_result = await self ._tracing_adapter .async_get_status (
126+ session ,
127+ rollout_id = row .execution_metadata .rollout_id ,
127128 )
128129 status = (status_result or {}).get ("status" )
129- if status and "code" in status :
130+ if isinstance ( status , dict ) and "code" in status :
130131 status_code = status ["code" ]
131132
132- if status_code == Status .Code .RUNNING :
133- await asyncio .sleep (poll_interval )
134- continue
135-
136133 logger .info (
137134 "Found status for rollout %s with code %s" ,
138135 row .execution_metadata .rollout_id ,
139136 status_code ,
140137 )
141138
142- # Backfill message/details/extras from the full Logs table (one-shot)
143- session = self ._get_or_create_session ()
144- completed_logs = await self ._tracing_adapter .async_search_logs (
145- session , tags = [f"rollout_id:{ row .execution_metadata .rollout_id } " ],
146- )
147- status_message = ""
148- status_details : list = []
149- status_extras : dict = {}
150- for log in completed_logs :
151- sd = log .get ("status" )
152- if sd and isinstance (sd , dict ) and "code" in sd :
153- status_message = sd .get ("message" , "" )
154- status_details = sd .get ("details" , [])
155- raw_extras = log .get ("extras" ) or {}
156- status_extras = {
157- k : v for k , v in raw_extras .items ()
158- if k not in ("logger_name" , "level" , "timestamp" )
159- }
160- break
139+ status_message = status .get ("message" , "" ) or ""
140+ status_details = status .get ("details" , []) or []
161141
162142 exception = exception_for_status_code (status_code , status_message )
163143 if exception is not None :
@@ -169,10 +149,12 @@ async def _process_row(row: EvaluationRow) -> EvaluationRow:
169149 details = status_details ,
170150 )
171151
172- if row .execution_metadata .extra :
173- row .execution_metadata .extra .update (status_extras )
174- else :
175- row .execution_metadata .extra = status_extras
152+ status_extras = status .get ("extras" )
153+ if isinstance (status_extras , dict ):
154+ if row .execution_metadata .extra :
155+ row .execution_metadata .extra .update (status_extras )
156+ else :
157+ row .execution_metadata .extra = status_extras
176158
177159 logger .info ("Stopping polling for rollout %s" , row .execution_metadata .rollout_id )
178160 break
0 commit comments