Skip to content

v1.0.18 — expose per-task queue and run timings

Choose a tag to compare

@adhikjoshi adhikjoshi released this 21 Aug 07:51
· 12 commits to main since this release
15849b5

Adds a queue-wait / run-time split that a producer can actually read.

Why: a generation API answered a request in 37.7s while the only timer in its response read generationTime: 5.55. That timer starts after enqueue, so it hid the handler's work and merged queue wait into the run. ModelQ already recorded the timestamps but never surfaced them.

Changes

  • The task decorator now mirrors created_at/queued_at onto the Task object it returns (previously written only into the Redis blob, so task.queued_at was always None).
  • Task.get_result() absorbs queued_at/started_at/finished_at from the terminal blob, before it can raise — so a failed or cancelled task still reports where its time went.
  • New Task.stage_timings() → {queue_time, run_time, total_time}. Stages that cannot be measured are omitted, never reported as 0.0.

Compatibility: fully additive. Result blobs from older workers leave existing timestamps untouched and stage_timings() returns {}.

PR: #20