Rewriting the queue-position message in testflinger-cli
A small CLI change for Testflinger that replaces the misleading "Jobs ahead in queue 0" line with a clearer "Queue position next in line", and pairs absolute position with jobs-ahead for the mid-queue case.
Testflinger is the broker that sits between CI and a hardware lab. While polling for a job, the CLI prints a queue-position line every few seconds. #793 (merged today) rewrites that line. This post is the technical write-up. Closes #461.
What was wrong before
When your job was first in the queue, the CLI said:
This job is waiting on a node to become available.
Jobs ahead in queue: 0
A few people I know read “0 jobs ahead” as “the CLI is stuck”. The number is correct but it’s the wrong number to lead with — when you are first in line, the answer to “where am I?” is a phrase, not a count.
What the change does
#793 rewrites the message in do_poll():
Before After
Jobs ahead in queue: 0 → Queue position: next in line
Jobs ahead in queue: 2 → Queue position: 3 (jobs ahead: 2)
When you’re first in line you get a phrase instead of a number. Mid-queue, both quantities are still on screen, because absolute position answers “when will this start?” and jobs-ahead answers “how busy is the queue right now?” — different questions, both useful.
Tests
Three new poll-loop tests cover the three states the message has to handle: first-in-line, mid-queue, and the transition from mid-queue down to first-in-line as jobs ahead of you finish.
Important Links
- The PR:
#793(merged 22 Oct 2025). - Closes:
#461. - Repo:
canonical/testflinger· docs.