Skip to content

Commit

Permalink
Fix reporting of initial status check time
Browse files Browse the repository at this point in the history
Now we report more than once a "first initial status check time".
The first is correct all the other are wrong.
Should fix point 7 in this analysis: https://gist.github.com/majamassarini/85033b59607a3f3da570cf5aaf2b8c7a
  • Loading branch information
majamassarini committed Oct 1, 2024
1 parent 4a5355f commit f4a96c4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packit_service/worker/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def process_jobs(self) -> List[TaskResults]:
allowlist = Allowlist(service_config=self.service_config)
processing_results: List[TaskResults] = []

statuses_check_feedback: List[datetime] = []
for handler_kls in handler_classes:
# TODO: merge to to get_handlers_for_event so
# so we don't need to go through the similar process twice.
Expand All @@ -483,12 +484,18 @@ def process_jobs(self) -> List[TaskResults]:
for job_config in job_configs
]

processing_results.extend(self.create_tasks(job_configs, handler_kls))
processing_results.extend(
self.create_tasks(job_configs, handler_kls, statuses_check_feedback)
)
self.push_statuses_metrics(statuses_check_feedback)

return processing_results

def create_tasks(
self, job_configs: List[JobConfig], handler_kls: Type[JobHandler]
self,
job_configs: List[JobConfig],
handler_kls: Type[JobHandler],
statuses_check_feedback: list[datetime],
) -> List[TaskResults]:
"""
Create handler tasks for handler and job configs.
Expand All @@ -499,7 +506,6 @@ def create_tasks(
"""
processing_results: List[TaskResults] = []
signatures = []
statuses_check_feedback = []
# we want to run handlers for all possible jobs, not just the first one
for job_config in job_configs:
if self.should_task_be_created_for_job_config_and_handler(
Expand Down Expand Up @@ -528,7 +534,6 @@ def create_tasks(
event=self.event,
)
)
self.push_statuses_metrics(statuses_check_feedback)
# https://docs.celeryq.dev/en/stable/userguide/canvas.html#groups
celery.group(signatures).apply_async()
return processing_results
Expand Down

0 comments on commit f4a96c4

Please sign in to comment.