Conversation
rene-oromtz
left a comment
There was a problem hiding this comment.
Thanks for taking a look at this!
I just added couple comments to match the current practices we are following and an important note regarding the queues collection.
Also, there is one test failing because the HTML lint. Can you run djlint --reformat src? That will do the formatting of this code automatically.
|
|
||
| queue_info = [] | ||
| for queue_name in agent_info.pop("queues", []): | ||
| queue_data = mongo.db.queues.find_one({"name": queue_name}) |
There was a problem hiding this comment.
Just note that the queues collection only reports "advertised queues" which does not accurately reflect the queues available.
You can use testflinger-cli list-queues to take a look at what it is exposed in that collection in production...
So for this I would suggest to get the name of the queue directly from the agent_info
There was a problem hiding this comment.
I have updated server/devel/create_sample_data.py to only add a select number of queues as advertised queues to help test this out.
| queue_data["numjobs"] = mongo.db.jobs.count_documents( | ||
| { | ||
| "job_data.job_queue": queue_name, | ||
| "result_data.job_state": { | ||
| "$nin": ["complete", "completed", "cancelled"] | ||
| }, | ||
| } | ||
| ) |
There was a problem hiding this comment.
Could you please move this logic to the database module? For the recent code changes, we've been trying to use this module as an abstraction layer for all db operations. In that module there is also get_jobs_on_queue so you can either use this same approach and filter the data by "running" jobs or you can add this new logic as a get_jobs_running or something along those lines, up to you
There was a problem hiding this comment.
I just checked at the codebase and this block is using the same logic, if you feel like it, can you also modify those lines to use this newly get_jobs_running or whatever you wish to call it? (That is if you choose to create a new function of course)
Also, that queues_data() function also shows how the queues view is built, you can use it as reference
|
One general comment @ajzobro, since you should have access; it would make it easier if you create branches on this repo itself rather than fork |
|
Moved to #853 |
Description
Converted the list of queues displayed on the agent detail page into a table (matching the format of the queue_detail page exactly).
Resolved issues
Resolves CERTF-756.
Documentation
Web service API changes
N/A
Tests
Updated
server/devel/create_sample_data.pyto allow for a random number of queues to be attributed to each agent for better testing.