Skip to content

Feature/certtf 756#848

Closed
ajzobro wants to merge 4 commits intocanonical:mainfrom
ajzobro:feature/CERTTF-756
Closed

Feature/certtf 756#848
ajzobro wants to merge 4 commits intocanonical:mainfrom
ajzobro:feature/CERTTF-756

Conversation

@ajzobro
Copy link
Copy Markdown
Collaborator

@ajzobro ajzobro commented Dec 12, 2025

Description

Converted the list of queues displayed on the agent detail page into a table (matching the format of the queue_detail page exactly).

image

Resolved issues

Resolves CERTF-756.

Documentation

Web service API changes

N/A

Tests

Updated server/devel/create_sample_data.py to allow for a random number of queues to be attributed to each agent for better testing.

Copy link
Copy Markdown
Contributor

@rene-oromtz rene-oromtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/src/testflinger/views.py Outdated
Comment on lines +99 to +106
queue_data["numjobs"] = mongo.db.jobs.count_documents(
{
"job_data.job_queue": queue_name,
"result_data.job_state": {
"$nin": ["complete", "completed", "cancelled"]
},
}
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

@rene-oromtz rene-oromtz Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@pedro-avalos
Copy link
Copy Markdown
Collaborator

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

@ajzobro ajzobro marked this pull request as draft December 18, 2025 17:37
@ajzobro
Copy link
Copy Markdown
Collaborator Author

ajzobro commented Dec 18, 2025

Moved to #853

@ajzobro ajzobro closed this Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants