Skip to content

Commit 38917bf

Browse files
committed
Add logs for inspecting celery queue delays
Using CoprBuildEndHandler as measuring task
1 parent 28fa5ff commit 38917bf

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

packit_service/worker/handlers/copr.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ def set_built_packages(self):
301301

302302
def run(self):
303303
run_start_time = datetime.now(timezone.utc)
304+
logger.info(
305+
f"[CELERY_EXEC] CoprBuildEndHandler execution started for "
306+
f"build_id={self.copr_event.build_id} "
307+
f"chroot={self.copr_event.chroot} "
308+
f"at {run_start_time.isoformat()}"
309+
)
304310
if not self.build:
305311
# TODO: how could this happen?
306312
model = "SRPMBuildDB" if self.copr_event.chroot == COPR_SRPM_CHROOT else "CoprBuildDB"

packit_service/worker/helpers/build/babysit.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@
5757

5858
def celery_run_async(signatures: list[Signature]) -> None:
5959
logger.debug("Signatures are going to be sent to Celery (from babysit task).")
60+
# Extract build_id from signatures for tracking
61+
build_ids = [
62+
str(build_id)
63+
for sig in signatures
64+
if sig.kwargs and (build_id := sig.kwargs.get("event", {}).get("build_id"))
65+
]
66+
build_ids_str = ", ".join(build_ids) if build_ids else "unknown"
67+
queued_time = datetime.now(timezone.utc)
68+
logger.info(
69+
f"[CELERY_QUEUE] Queuing {len(signatures)} task(s) for Copr build(s) {build_ids_str} "
70+
f"at {queued_time.isoformat()}"
71+
)
6072
# https://docs.celeryq.dev/en/stable/userguide/canvas.html#groups
6173
celery.group(signatures).apply_async()
6274
logger.debug("Signatures were sent to Celery.")

0 commit comments

Comments
 (0)