-
Notifications
You must be signed in to change notification settings - Fork 37
Cli agent display number of jobs #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ajzobro
wants to merge
10
commits into
main
Choose a base branch
from
CLI-agent-display-number-of-jobs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+154
−71
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…exist across all agent queues
…xed the agent detail page, updated the queue description to match the display of the queue list page (blank when no description).
…port of adding more human readable YAML output format for displaying job counts, and included documentation for the various uses of the agent-status command.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #859 +/- ##
==========================================
- Coverage 71.38% 71.06% -0.33%
==========================================
Files 108 108
Lines 9674 9601 -73
Branches 860 856 -4
==========================================
- Hits 6906 6823 -83
- Misses 2595 2607 +12
+ Partials 173 171 -2
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added command line interface to support display of number of jobs per queue that a given agent is monitoring. Depending on the number of other agents monitoring the same queues that a given agent is monitoring, this agent could be responsible for anywhere from 0 to all of the jobs on those queues.
The following will now also show the job count on queues rather than return a list (potentially breaking change if users are looping over the values (queue names) in the current list and would likely end up up looping over job counts in the new structure)
{"agent": "agent3", "provision_streak_count": 1, "provision_streak_type": "pass", "queues": ["test_queue6", "test_queue3", "test_queue7", "test_queue0", "test_queue8", "test_queue1", "test_queue5"], "restricted_to": {}, "status": "waiting", "updated_at": {"$date": "2026-01-05T18:06:00.631Z"}}{"agent": "agent3", "provision_streak_count": 1, "provision_streak_type": "pass", "queues": {"test_queue0": {"num_jobs": 0}, "test_queue1": {"num_jobs": 1}, "test_queue3": {"num_jobs": 0}, "test_queue5": {"num_jobs": 3}, "test_queue6": {"num_jobs": 0}, "test_queue7": {"num_jobs": 2}, "test_queue8": {"num_jobs": 2}}, "restricted_to": {}, "status": "waiting", "updated_at": {"$date": "2026-01-05T18:06:00.631Z"}}And added a much more human-readable YAML option to support displaying the same information in a way that is non-breaking and does not introduce yet another format in printed text.
Note: the observation has been made that
jqcan be used to prettify the testflinger JSON output, e.g.:testflinger agent-status agent2 --json | jq "." --indent 4. However this does not resolve the fact that the changes to the JSON structure are breaking changes.As a side note, the
yqcommand can also be used to convert to JSON and even prove the same results are achieved by both, e.g.:diff <(testflinger agent-status agent2 --yaml | yq e "." --indent 4 -o json) <(testflinger agent-status agent2 --json | jq "." --indent 4)Options:
jq "." --indent 4--jsonover--yamlif both provided (current proposed behavior, undocumented)queuesas a list:job_countforqueueof same index into the listqueues_with_datadictionary matching the format proposed aboveResolved issues
Relates to CERTF-756. (#853)
Documentation
See docs/
docs/how-to/view-agent-status.rst
Web service API changes
N/A
Tests
Tests added for new YAML output and updated for adjusted JSON output format.