mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 02:46:53 +00:00
Optimize task statistics for projects dashboard and statistics reporter
This commit is contained in:
parent
8a99eb6812
commit
49084a9c49
@ -341,6 +341,17 @@ class ProjectBLL:
|
||||
) -> Tuple[Sequence, Sequence]:
|
||||
archived = EntityVisibility.archived.value
|
||||
|
||||
def project_task_fields():
|
||||
return {
|
||||
"$project": {
|
||||
"project": 1,
|
||||
"status": 1,
|
||||
"system_tags": 1,
|
||||
"started": 1,
|
||||
"completed": 1,
|
||||
}
|
||||
}
|
||||
|
||||
def ensure_valid_fields():
|
||||
"""
|
||||
Make sure system tags is always an array (required by subsequent $in in archived_tasks_cond
|
||||
@ -368,6 +379,7 @@ class ProjectBLL:
|
||||
users=users,
|
||||
)
|
||||
},
|
||||
project_task_fields(),
|
||||
ensure_valid_fields(),
|
||||
{
|
||||
"$group": {
|
||||
@ -516,6 +528,7 @@ class ProjectBLL:
|
||||
users=users,
|
||||
)
|
||||
},
|
||||
project_task_fields(),
|
||||
ensure_valid_fields(),
|
||||
{
|
||||
# for each project
|
||||
|
@ -254,6 +254,14 @@ class StatisticsReporter:
|
||||
**({"last_worker": {"$in": workers}} if workers else {}),
|
||||
}
|
||||
},
|
||||
{
|
||||
"$project": {
|
||||
"last_worker": 1,
|
||||
"last_update": 1,
|
||||
"started": 1,
|
||||
"last_iteration": 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
"$group": {
|
||||
"_id": "$last_worker" if workers else None,
|
||||
|
Loading…
Reference in New Issue
Block a user