Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions clients/python/src/taskbroker_client/worker/workerchild.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,33 @@ def check_task_future_completion(
local_shutdown.set()
break

fetch_wait_start = time.monotonic()
try:
inflight = child_tasks.get(timeout=1.0)
except queue.Empty:
metrics.distribution(
"taskworker.worker.child.fetch_wait_duration",
time.monotonic() - fetch_wait_start,
tags={
"processing_pool": processing_pool_name,
"outcome": "empty",
},
)
metrics.incr(
"taskworker.worker.child_task_queue_empty",
tags={"processing_pool": processing_pool_name},
)
continue

metrics.distribution(
"taskworker.worker.child.fetch_wait_duration",
time.monotonic() - fetch_wait_start,
tags={
"processing_pool": processing_pool_name,
"outcome": "task",
},
)

# Open the busy segment as soon as we have a task. The slot is now
# unavailable for new work, whatever stage of handling it is in.
messages.put_nowait(ChildMessage(child_id, "busy"))
Expand Down
Loading