You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The worker orphan recovery feature (#129) added retry_job() to JobQueryService and _recover_orphaned_jobs() to the worker loop. While worker.py already uses structlog extensively (20+ log calls), job_query_service.py has zero logging — no import, no logger, no log calls.
Gap
JobQueryService (no logging at all)
retry_job() — no log when a job is retried (who triggered it, previous state, job ID)
cancel_job() — no log when a job is cancelled
start_job() — no log when a job is started
create_job() — no log when a job is created
Worker orphan recovery (partial logging)
_recover_orphaned_jobs_with_session() logs only the count ("Periodic orphan recovery complete", count=recovered) — does not log individual job recoveries (previous status, job ID, stale duration)
_terminate_orphans_with_session() has no logging for individual terminations
Proposed scope
Add structlog to job_query_service.py — log all state-changing operations (create, start, cancel, retry) with job ID, previous status, new status
Enhance _recover_orphaned_jobs_with_session() in worker.py — log each recovered job with job ID, previous status, stale duration
Enhance _terminate_orphans_with_session() — log each terminated orphan with job ID, previous status, termination reason
Context
The worker orphan recovery feature (#129) added
retry_job()toJobQueryServiceand_recover_orphaned_jobs()to the worker loop. Whileworker.pyalready usesstructlogextensively (20+ log calls),job_query_service.pyhas zero logging — no import, no logger, no log calls.Gap
JobQueryService (no logging at all)
retry_job()— no log when a job is retried (who triggered it, previous state, job ID)cancel_job()— no log when a job is cancelledstart_job()— no log when a job is startedcreate_job()— no log when a job is createdWorker orphan recovery (partial logging)
_recover_orphaned_jobs_with_session()logs only the count ("Periodic orphan recovery complete", count=recovered) — does not log individual job recoveries (previous status, job ID, stale duration)_terminate_orphans_with_session()has no logging for individual terminationsProposed scope
structlogtojob_query_service.py— log all state-changing operations (create, start, cancel, retry) with job ID, previous status, new status_recover_orphaned_jobs_with_session()inworker.py— log each recovered job with job ID, previous status, stale duration_terminate_orphans_with_session()— log each terminated orphan with job ID, previous status, termination reasonWhy separate from #129
Related
fix/worker-orphan-recovery-8