Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
d42a8848
Commit
d42a8848
authored
3 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-770
: Add fraction percentages; minor fixes
parent
5fca25b8
No related branches found
No related tags found
3 merge requests
!634
WIP: COBALT commissioning delta
,
!522
Resolve TMSS-770
,
!481
Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+15
-8
15 additions, 8 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
with
15 additions
and
8 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+
15
−
8
View file @
d42a8848
...
...
@@ -54,9 +54,13 @@ def _get_telescope_time_distribution(cycle: models.Cycle, start: datetime, stop:
total
+=
sub
.
observed_duration
.
total_seconds
()
succeeded
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
else
0
failed
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
is
False
else
0
# Calculate derived and store durations
idle
=
total
-
succeeded
-
failed
result
[
c
if
c
==
'
UNASSIGNED
'
or
c
==
'
FILLER
'
else
c
.
name
]
=
{
'
durations
'
:
{
'
total
'
:
total
,
'
succeeded
'
:
succeeded
,
'
failed
'
:
failed
,
'
idle
'
:
idle
}}
succeeded_perc
=
succeeded
*
100.0
/
total
if
total
>
0
else
None
failed_perc
=
failed
*
100.0
/
total
if
total
>
0
else
None
idle_perc
=
idle
*
100.0
/
total
if
total
>
0
else
None
durations
=
{
'
total
'
:
total
,
'
succeeded
'
:
succeeded
,
'
succeeded_perc
'
:
succeeded_perc
,
'
failed
'
:
failed
,
'
failed_perc
'
:
failed_perc
,
'
idle
'
:
idle
,
'
idle_perc
'
:
idle_perc
}
result
[
c
if
c
==
'
UNASSIGNED
'
or
c
==
'
FILLER
'
else
c
.
name
]
=
{
'
durations
'
:
durations
}
return
result
...
...
@@ -84,7 +88,7 @@ def _get_average_efficiency(cycle: models.Cycle, start: datetime, stop: datetime
sup
=
SchedulingUnitProcess
.
objects
.
filter
(
su
=
sub
).
first
()
total_per_day
+=
sub
.
observed_duration
.
total_seconds
()
total_succeeded_per_day
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
else
0
efficiency_per_day
+=
total_succeeded_per_day
/
total_per_day
if
total_per_day
>
0
else
0
efficiency_per_day
+=
total_succeeded_per_day
*
100.0
/
total_per_day
if
total_per_day
>
0
else
0
i
+=
1
d
+=
step
...
...
@@ -112,12 +116,14 @@ def _get_completion_level(cycle: models.Cycle, start: datetime, stop: datetime)
sup
=
SchedulingUnitProcess
.
objects
.
filter
(
su
=
sub
).
first
()
total
+=
sub
.
observed_duration
.
total_seconds
()
total_succeeded
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
else
0
result
[
'
total
'
],
result
[
'
succeeded
'
]
=
total
,
total_succeeded
# Store durations
succeeded_perc
=
total_succeeded
*
100.0
/
total
if
total
>
0
else
None
result
[
'
total
'
],
result
[
'
succeeded
'
],
result
[
'
succeeded_perc
'
]
=
total
,
total_succeeded
,
succeeded_perc
# Calculate prognosis
unschedulable_subtasks
=
models
.
Subtask
.
objects
.
filter
(
task_blueprints__scheduling_unit_blueprint__in
=
subs
).
filter
(
state
=
'
unschedulable
'
)
unschedulable_duration
=
sum
([
uns
.
specified_duration
.
total_seconds
()
for
uns
in
unschedulable_subtasks
])
result
[
'
prognosis
'
]
=
(
total
-
unschedulable_duration
)
*
100.0
/
total
if
total
>
0
and
total
>=
unschedulable_duration
else
None
result
[
'
prognosis
'
]
=
unschedulable_duration
*
100.0
/
total
if
total
>
0
else
None
return
result
...
...
@@ -182,8 +188,8 @@ def _get_weekly_efficiency(cycle: models.Cycle, start: datetime, stop: datetime)
sup
=
SchedulingUnitProcess
.
objects
.
filter
(
su
=
sub
).
first
()
total_per_week
+=
sub
.
observed_duration
.
total_seconds
()
total_succeeded_per_week
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
else
0
result
[
'
weeks
'
].
append
(
{
'
week
'
:
d
.
date
().
isoformat
(),
'
efficiency
'
:
total_succeeded_per_week
/
total_per_week
if
total_per_week
>
0
else
None
})
efficiency
=
total_succeeded_per_week
*
100.0
/
total_per_week
if
total_per_week
>
0
else
None
result
[
'
weeks
'
].
append
(
{
'
week
'
:
d
.
date
().
isoformat
(),
'
efficiency
'
:
efficiency
})
d
+=
step
return
result
...
...
@@ -297,7 +303,8 @@ def _get_failures(cycle: models.Cycle, start: datetime, stop: datetime) -> {}:
sup
=
SchedulingUnitProcess
.
objects
.
filter
(
su
=
sub
).
first
()
total_per_month
+=
sub
.
observed_duration
.
total_seconds
()
total_failed_per_month
+=
sub
.
observed_duration
.
total_seconds
()
if
sup
and
sup
.
results_accepted
is
False
else
0
result
[
'
months
'
].
append
({
'
month
'
:
d
.
date
().
isoformat
(),
'
total
'
:
total_per_month
,
'
total_failed
'
:
total_failed_per_month
})
failed_perc
=
total_failed_per_month
*
100.0
/
total_per_month
if
total_per_month
>
0
else
None
result
[
'
months
'
].
append
({
'
month
'
:
d
.
date
().
isoformat
(),
'
total
'
:
total_per_month
,
'
total_failed
'
:
total_failed_per_month
,
'
failed_perc
'
:
failed_perc
})
d
+=
step
return
result
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment