Skip to content

Commit 15654cc

Browse files
committed
Fix formatting issues.
1 parent f589d52 commit 15654cc

File tree

2 files changed

+248
-154
lines changed

2 files changed

+248
-154
lines changed

.ci/metrics/metrics.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ def _construct_aggregate(ag_name: str, job_list: list[JobMetrics]) -> AggregateM
150150
# Compute aggregate queue time (in seconds, not ns)
151151
ag_queue_time = (latest_start - earliest_create) / 1000000000
152152
# Append the aggregate metrics to the workflow metrics list.
153-
return AggregateMetric(ag_name, ag_queue_time, ag_run_time, ag_status,
154-
latest_complete, ag_workflow_id)
153+
return AggregateMetric(
154+
ag_name, ag_queue_time, ag_run_time, ag_status, latest_complete, ag_workflow_id
155+
)
155156

156157
def create_and_append_libcxx_aggregates(workflow_metrics: list[JobMetrics]):
157158
"""Find libc++ JobMetric entries and create aggregate metrics for them.
@@ -174,7 +175,7 @@ def create_and_append_libcxx_aggregates(workflow_metrics: list[JobMetrics]):
174175
if job.workflow_name != "Build and Test libc++":
175176
continue
176177
if job.workflow_id not in aggregate_data.keys():
177-
aggregate_data[job.workflow_id] = [ job ]
178+
aggregate_data[job.workflow_id] = [job]
178179
else:
179180
aggregate_data[job.workflow_id].append(job)
180181

@@ -187,26 +188,30 @@ def create_and_append_libcxx_aggregates(workflow_metrics: list[JobMetrics]):
187188
stage3_jobs = list()
188189
# sort jobs into stage1, stage2, & stage3.
189190
for job in job_list:
190-
if job.job_name.find('stage1') > 0:
191+
if job.job_name.find("stage1") > 0:
191192
stage1_jobs.append(job)
192-
elif job.job_name.find('stage2') > 0:
193+
elif job.job_name.find("stage2") > 0:
193194
stage2_jobs.append(job)
194-
elif job.job_name.find('stage3') > 0:
195+
elif job.job_name.find("stage3") > 0:
195196
stage3_jobs.append(job)
196197

197198
if len(stage1_jobs) > 0:
198199
aggregate = _construct_aggregate(
199-
"github_libcxx_premerge_checks_stage1_aggregate", stage1_jobs)
200+
"github_libcxx_premerge_checks_stage1_aggregate", stage1_jobs
201+
)
200202
workflow_metrics.append(aggregate)
201203
if len(stage2_jobs) > 0:
202204
aggregate = _construct_aggregate(
203-
"github_libcxx_premerge_checks_stage2_aggregate", stage2_jobs)
205+
"github_libcxx_premerge_checks_stage2_aggregate", stage2_jobs
206+
)
204207
workflow_metrics.append(aggregate)
205208
if len(stage3_jobs) > 0:
206209
aggregate = _construct_aggregate(
207-
"github_libcxx_premerge_checks_stage3_aggregate", stage3_jobs)
210+
"github_libcxx_premerge_checks_stage3_aggregate", stage3_jobs
211+
)
208212
workflow_metrics.append(aggregate)
209213

214+
210215
def clean_up_libcxx_job_name(old_name: str) -> str:
211216
"""Convert libcxx job names to generically legal strings.
212217
@@ -224,17 +229,17 @@ def clean_up_libcxx_job_name(old_name: str) -> str:
224229
"""
225230
# Names should have exactly one set of parentheses, so break on that. If
226231
# they don't have any parentheses, then don't update them at all.
227-
if old_name.find('(') == -1:
232+
if old_name.find("(") == -1:
228233
return old_name
229-
stage, remainder = old_name.split('(')
234+
stage, remainder = old_name.split("(")
230235
stage = stage.strip()
231-
if remainder[-1] == ')':
236+
if remainder[-1] == ")":
232237
remainder = remainder[:-1]
233-
remainder = remainder.replace('-', '_')
234-
remainder = remainder.replace(',', '_')
235-
remainder = remainder.replace(' ', '_')
236-
remainder = remainder.replace('+', 'x')
237-
new_name = stage + '_' + remainder
238+
remainder = remainder.replace("-", "_")
239+
remainder = remainder.replace(",", "_")
240+
remainder = remainder.replace(" ", "_")
241+
remainder = remainder.replace("+", "x")
242+
new_name = stage + "_" + remainder
238243
return new_name
239244

240245
def github_get_metrics(
@@ -304,7 +309,7 @@ def github_get_metrics(
304309

305310
libcxx_testing = False
306311
if task.name == "Build and Test libc++":
307-
libcxx_testing = True
312+
libcxx_testing = True
308313

309314
if task.status == "completed":
310315
workflow_seen_as_completed.add(task.id)
@@ -318,8 +323,7 @@ def github_get_metrics(
318323
if libcxx_testing:
319324
# We're not running macos or windows libc++ tests on our
320325
# infrastructure.
321-
if (job.name.find("macos") != -1 or
322-
job.name.find("windows") != -1):
326+
if job.name.find("macos") != -1 or job.name.find("windows") != -1:
323327
continue
324328
# This job is not interesting to us.
325329
elif job.name not in GITHUB_JOB_TO_TRACK[name_prefix]:

0 commit comments

Comments
 (0)