Open Bug 2057401 Opened 4 months ago Updated 4 months ago

[meta] Deferred jobs management

Categories

(Conduit :: Lando, task)

Tracking

(Not tracked)

People

(Reporter: shtrom, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: meta)

This is a discussion bug, to highlight and link multiple related things, and how to address them with pros and cons.

The surface problem is that some jobs (both Landing and Automation) fail repeatedly on issues that are marked as retriable (Treestatus, SCM errors (push, repo state, ...), ...). Those jobs get marked as deferred, but get picked-up again repeatedly, preventing any other job from being processed, and essentially blocking all subsequent jobs on the worker until manual intervention.

This both impacts the creator of the job, who can't land their work, and everybody else, who's waiting for their work to land.

The following are proposed fixes, they are not all required, nor are they exclusive (i.e., we can do more than one).

  • Terminate jobs after a set number of deferrals (bug 2021999)
    • Pro: the queue ultimately recovers
    • Cons:
      • it may be detrimental to terminate jobs deferred on Treestatus -> need to better identify failure cases in terms of terminable or not
      • users may not expect a job to be cancelled -> need to be informed that their job was cancelled
  • Allow a user to cancel a (repeatedly failing) job, including automation. This will required showing the “Cancel job” button on Deferred and In progress jobs in addition to Submitted ones (landing), as well as adding a cancel-job option to lando-cli (automation).
    • Pro: other users are no longer impacted
    • Cons:
      • the job creator job's is still stalled
      • Race condition if the job is already in progress -> Workers should not change a failing job that was currently processing from Cancelled back to Deferred
  • Change the ordering of jobs: currently we sort jobs is descending order https://github.com/mozilla-conduit/lando/blob/1c435c669233f32f3de2b5d39197800e222ad1ca/src/lando/main/models/jobs.py#L270 of statuses https://github.com/mozilla-conduit/lando/blob/1c435c669233f32f3de2b5d39197800e222ad1ca/src/lando/main/models/jobs.py#L43-L56 (so: DEFERRED, IN_PROGRESS, SUBMITTED). Change this so deferred jobs are last.
    • Pro: (potentially blocking) deferred jobs are only processed when the queue has emptied, and may ultimately succeed
    • Cons:
      • out-of-order processing: a job may be processed sooner than a job submitted earlier. This may lead to a confusing situation if there is a dependency on one job (A to succeed first for another one (B) to succeed: If A gets deferred, B will fail, and A will ultimately succeed, making it unclear why B has failed without looking at the landing history and the order in which each job has succeeded/failed (i.e., B would fail first, before A ultimately lands)
      • we may have a long-tail of forever-deferred jobs that would need investigation/termination (maybe on date rather than number of retries)
    • Unclear: do we (re)process IN_PROGRESS, or SUBMITTED jobs first?
See Also: → 2054234
See Also: → 2057368
Keywords: meta
Summary: Deferred jobs management → [meta] Deferred jobs management
Blocks: lando-qol
You need to log in before you can comment on or make changes to this bug.