mirror of
https://github.com/clearml/clearml-server
synced 2025-02-07 13:33:42 +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]:
|
) -> Tuple[Sequence, Sequence]:
|
||||||
archived = EntityVisibility.archived.value
|
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():
|
def ensure_valid_fields():
|
||||||
"""
|
"""
|
||||||
Make sure system tags is always an array (required by subsequent $in in archived_tasks_cond
|
Make sure system tags is always an array (required by subsequent $in in archived_tasks_cond
|
||||||
@ -368,6 +379,7 @@ class ProjectBLL:
|
|||||||
users=users,
|
users=users,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
project_task_fields(),
|
||||||
ensure_valid_fields(),
|
ensure_valid_fields(),
|
||||||
{
|
{
|
||||||
"$group": {
|
"$group": {
|
||||||
@ -516,6 +528,7 @@ class ProjectBLL:
|
|||||||
users=users,
|
users=users,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
project_task_fields(),
|
||||||
ensure_valid_fields(),
|
ensure_valid_fields(),
|
||||||
{
|
{
|
||||||
# for each project
|
# for each project
|
||||||
|
@ -254,6 +254,14 @@ class StatisticsReporter:
|
|||||||
**({"last_worker": {"$in": workers}} if workers else {}),
|
**({"last_worker": {"$in": workers}} if workers else {}),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"$project": {
|
||||||
|
"last_worker": 1,
|
||||||
|
"last_update": 1,
|
||||||
|
"started": 1,
|
||||||
|
"last_iteration": 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"$group": {
|
"$group": {
|
||||||
"_id": "$last_worker" if workers else None,
|
"_id": "$last_worker" if workers else None,
|
||||||
|
Loading…
Reference in New Issue
Block a user