Group task results
phemmer opened this issue · 4 comments
What is the idea ?
Currently when viewing a playbook report, you only get 2 views: The "Hosts" view which shows a list of ok/changed/skipped/... per-host. And the "Task results" which gives each individual task on every host.
I think it would be good to provide another view that would group the results by task. This would show a count of hosts which were ok/skipped/changed/failed for each task. Clicking on the task would explode the view to show that task on each host (like what you see currently).
The use case for this is that when ansible is run across a pool of hosts, the results are often the same on each host. When you want to see the status of each task, it becomes difficult with all the duplicate rows, across dozens+ of pages. Being able to quickly see things like "this task was OK on all hosts but 1" would make it easy to detect anomalies, and/or skim the results.
Additionally when Ansible is run with the linear strategy, Ansible won't continue to the next task until all hosts are complete for the current task. This view would make it possible to show the duration of the task across all hosts, allowing you to identify bottlenecks in playbook execution. You cannot use the current task duration for this, as due to things like the "serial" value, total task duration isn't as simple as a sum of all the durations, or taking the max duration.
I think the hopefully soon released version 1.6.0 introduces exactly what you describe: a tasks page.
You can already check it out here: https://demo.recordsansible.org/tasks
Thanks, but not really what I was describing. Below an example / mockup of my concept.
This first image is what it currently looks like at https://demo.recordsansible.org/playbooks/2126.html
And this is my concept with the exact same tasks, but grouped by task.
"Status" is the count of hosts with each status for the task (not sure why the original data has some hosts missing on a few of the tasks, but I preserved that).
"Date" is the date/time the task started (not the date/time of completion).
"Duration" is the time between task start, and completion time of the last host.
Clicking "report" will take you to the playbook page as it currently looks in the first image (meaning a separate row for each host), but filtered to that task.
https://demo.recordsansible.org/tasks?playbook=2126
And this is the new introduced task page filter for your mentioned playbook:
Imo this is pretty the same :) There is just the difference that in your mockup you have put the status of the related results into the status column, while in the current implementation it is the status of taks itself (which is either ok or failed).
The technical background: there are tasks and results. A result is alwasy related to a task. What you can see on the playbook page are results. On the the tasks page you can see the tasks, but they are not group, but different database model.
You can find more information also here: https://ara.readthedocs.io/en/latest/api-documentation.html?highlight=relation#relationship-between-objects
But I really like your idea of having directly the result status in the status column instead of just having ok or fail. This would make it more consistent in look and feel also with the hosts page. And I think the current task status implementation was also really buggy at the beginnging and @dmsimard spent a lot of hours for that.
I will check the feasability of that if I find a bit time.
And I think the current task status implementation was also really buggy at the beginnging and @dmsimard spent a lot of hours for that.
I wouldn't say that it was buggy but it was challenging and took a lot of time and iterations to get it right :)
For context, before 1.6.0, ara didn't have the concept of a "failed" task, only whether it was running or completed.
Now we have a "failed" task status which is used when at least one host has a failed result.
I don't think that is mutually exclusive with the proposal of grouping results by tasks kind of like what we do for the hosts page.
The statuses that we use in the hosts page come for "free" because they are part of the model and populated by ansible when it provides stats:
Lines 232 to 236 in 9c80c7a
To get the number of task results for each status means either iterating through the each result and counting them (probably expensive performance hit for large inventories) or doing some form of single query that counts uniques (better).
It leaves the question of where to do it (in the view? an API endpoint?) and how.
I don't have bandwidth for this one right now but feel free to propose a PoC or something and we can discuss it there.