@@ -142,32 +142,38 @@ def _get_status() -> Dict[str, Any]:
142142 completed_logs = self ._tracing_adapter .search_logs (
143143 tags = [f"rollout_id:{ row .execution_metadata .rollout_id } " ]
144144 )
145- if completed_logs :
146- latest_log = completed_logs [0 ]
145+ # Filter for logs that actually have status information
146+ status_logs = []
147+ for log in completed_logs :
148+ status_dict = log .get ("status" )
149+ if status_dict and isinstance (status_dict , dict ) and "code" in status_dict :
150+ status_logs .append (log )
151+
152+ if status_logs :
153+ # Use the first log with status information
154+ status_log = status_logs [0 ]
155+ status_dict = status_log .get ("status" )
147156
148157 logger .info (
149- f"Found completion log for rollout { row .execution_metadata .rollout_id } : { latest_log .get ('message' , '' )} "
158+ f"Found status log for rollout { row .execution_metadata .rollout_id } : { status_log .get ('message' , '' )} "
150159 )
151160
152- # Look for structured status dictionary in status field
153- status_dict = latest_log .get ("status" )
154- if status_dict and isinstance (status_dict , dict ) and "code" in status_dict :
155- status_code = status_dict .get ("code" )
156- status_message = status_dict .get ("message" , "" )
157- status_details = status_dict .get ("details" , [])
161+ status_code = status_dict .get ("code" )
162+ status_message = status_dict .get ("message" , "" )
163+ status_details = status_dict .get ("details" , [])
158164
159- logger .info (
160- f"Found Fireworks log for rollout { row .execution_metadata .rollout_id } with status code { status_code } "
161- )
165+ logger .info (
166+ f"Found Fireworks log for rollout { row .execution_metadata .rollout_id } with status code { status_code } "
167+ )
162168
163- row .rollout_status = Status (
164- code = Status .Code (status_code ),
165- message = status_message ,
166- details = status_details ,
167- )
169+ row .rollout_status = Status (
170+ code = Status .Code (status_code ),
171+ message = status_message ,
172+ details = status_details ,
173+ )
168174
169- logger .info ("Stopping polling for rollout %s" , row .execution_metadata .rollout_id )
170- break
175+ logger .info ("Stopping polling for rollout %s" , row .execution_metadata .rollout_id )
176+ break
171177
172178 await asyncio .sleep (poll_interval )
173179 else :
0 commit comments