Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorguidi committed Dec 16, 2024
1 parent 73d3272 commit cb8b390
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/clusterfuzz/_internal/common/testcase_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def emit_testcase_triage_duration_metric(testcase_id: int, step: str):
'analyze_launched', 'analyze_completed', 'minimize_completed',
'regression_completed', 'impact_completed', 'issue_updated'
]
elapsed_time_since_upload = datetime.datetime.utcnow()
elapsed_time_since_upload -= testcase_upload_metadata.timestamp
elapsed_time_since_upload = elapsed_time_since_upload.total_seconds() / 3600

testcase = data_handler.get_testcase_by_id(testcase_id)

Expand All @@ -74,12 +71,15 @@ def emit_testcase_triage_duration_metric(testcase_id: int, step: str):
logs.warning(f'No timestamp associated to testcase {testcase_id},'
' failed to emit TESTCASE_UPLOAD_TRIAGE_DURATION metric.')
return

testcase_age_in_hours = testcase.get_age_in_seconds() / 3600

logs.info('Emiting TESTCASE_UPLOAD_TRIAGE_DURATION metric for testcase '
f'{testcase_id} (age = {elapsed_time_since_upload}) '
f'{testcase_id} (age = {testcase_age_in_hours} hours.) '
'in step {step}.')

monitoring_metrics.TESTCASE_UPLOAD_TRIAGE_DURATION.add(
testcase.get_age_in_seconds(),
testcase_age_in_hours,
labels={
'job': testcase.job_type,
'step': step,
Expand Down
4 changes: 0 additions & 4 deletions src/clusterfuzz/_internal/cron/triage.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ def main():
# finished.
if not critical_tasks_completed:
_emit_untriaged_testcase_age_metric(testcase)
untriaged_testcases += 1
_set_testcase_stuck_state(testcase, True)
_increment_untriaged_testcase_count(testcase.job_type,
PENDING_CRITICAL_TASKS)
Expand All @@ -454,7 +453,6 @@ def main():
if not testcase.group_id and not dates.time_has_expired(
testcase.timestamp, hours=data_types.MIN_ELAPSED_TIME_SINCE_REPORT):
_emit_untriaged_testcase_age_metric(testcase)
untriaged_testcases += 1
_set_testcase_stuck_state(testcase, True)
_increment_untriaged_testcase_count(testcase.job_type, PENDING_GROUPING)
logs.info(f'Skipping testcase {testcase_id}, pending grouping.')
Expand All @@ -463,7 +461,6 @@ def main():
if not testcase.get_metadata('ran_grouper'):
# Testcase should be considered by the grouper first before filing.
_emit_untriaged_testcase_age_metric(testcase)
untriaged_testcases += 1
_set_testcase_stuck_state(testcase, True)
_increment_untriaged_testcase_count(testcase.job_type, PENDING_GROUPING)
logs.info(f'Skipping testcase {testcase_id}, pending grouping.')
Expand Down Expand Up @@ -495,7 +492,6 @@ def main():

# A testcase is untriaged, until immediately before a bug is opened
_emit_untriaged_testcase_age_metric(testcase)
untriaged_testcases += 1
_set_testcase_stuck_state(testcase, False)
_increment_untriaged_testcase_count(testcase.job_type, PENDING_FILING)

Expand Down

0 comments on commit cb8b390

Please sign in to comment.