Skip to content

Commit c36bfd8

Browse files
authored
fix loop step time log problem (#1158)
1 parent 909c7d6 commit c36bfd8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

rdagent/utils/workflow/loop.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,6 @@ async def _run_step(self, li: int, force_subproc: bool = False) -> None:
235235
# Store result in the nested dictionary
236236
self.loop_prev_out[li][name] = result
237237

238-
# Record the trace
239-
end = datetime.now(timezone.utc)
240-
self.loop_trace[li].append(LoopTrace(start, end, step_idx=si))
241-
logger.log_object(
242-
{
243-
"start_time": start,
244-
"end_time": end,
245-
},
246-
tag="time_info",
247-
)
248238
# Save snapshot after completing the step
249239
self.dump(self.session_folder / f"{li}" / f"{si}_{name}")
250240
except Exception as e:
@@ -264,6 +254,16 @@ async def _run_step(self, li: int, force_subproc: bool = False) -> None:
264254
else:
265255
raise # re-raise unhandled exceptions
266256
finally:
257+
# Record the trace
258+
end = datetime.now(timezone.utc)
259+
self.loop_trace[li].append(LoopTrace(start, end, step_idx=si))
260+
logger.log_object(
261+
{
262+
"start_time": start,
263+
"end_time": end,
264+
},
265+
tag="time_info",
266+
)
267267
if step_forward:
268268
# Increment step index
269269
self.step_idx[li] = next_step_idx

0 commit comments

Comments
 (0)