Skip to content

Commit cc2a51b

Browse files
committed
style: apply ruff formatting
Change-Id: I04fb9ad0a7145958d4071630e03a1ccf1b17332b
1 parent c9750b8 commit cc2a51b

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

scripts/parse_log_and_summarize.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,14 @@ def analyze_step_time_breakdown(log_file_path):
160160

161161
step_match = train_step_pattern.search(line)
162162
if step_match:
163-
events.append({
164-
"type": "step",
165-
"step": int(step_match.group(1)),
166-
"train_time": float(step_match.group(2))
167-
})
163+
events.append(
164+
{"type": "step", "step": int(step_match.group(1)), "train_time": float(step_match.group(2))}
165+
)
168166
except Exception as e:
169167
print(f"Error analyzing breakdown: {e}")
170168
return []
171169

172-
# 2. Calculate Dynamic Threshold
170+
# 2. Calculate Dynamic Threshold
173171
# This threshold represents the minimum expected time interval between
174172
# the timestamps of two consecutive steps.
175173
THRESHOLD_BUFFER_SECONDS = 2.0
@@ -210,11 +208,7 @@ def analyze_step_time_breakdown(log_file_path):
210208
finish_time = events[j]["val"]
211209
break
212210

213-
processed_steps.append({
214-
"step": step_num,
215-
"finish_time": finish_time,
216-
"train_time": train_time
217-
})
211+
processed_steps.append({"step": step_num, "finish_time": finish_time, "train_time": train_time})
218212

219213
# 4. Calculate final gaps
220214
for i in range(1, len(processed_steps)):
@@ -224,13 +218,15 @@ def analyze_step_time_breakdown(log_file_path):
224218
if curr["step"] > prev["step"]:
225219
time_delta = max((curr["finish_time"] - prev["finish_time"]).total_seconds(), 0.0)
226220
other_time = time_delta - curr["train_time"]
227-
results.append({
228-
"step": curr["step"],
229-
"timestamp": curr["finish_time"],
230-
"total_gap": time_delta,
231-
"train_time": curr["train_time"],
232-
"other_time": other_time,
233-
})
221+
results.append(
222+
{
223+
"step": curr["step"],
224+
"timestamp": curr["finish_time"],
225+
"total_gap": time_delta,
226+
"train_time": curr["train_time"],
227+
"other_time": other_time,
228+
}
229+
)
234230

235231
return results
236232

0 commit comments

Comments
 (0)