Skip to content
GitLab
Explore
Sign in
Register
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
00c2227b
Commit
00c2227b
authored
3 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-770
: Add prognosis field in get_completion_level
parent
e0fe1386
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
+10
-5
10 additions, 5 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
with
10 additions
and
5 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+
10
−
5
View file @
00c2227b
...
...
@@ -67,7 +67,7 @@ def _get_average_efficiency(cycle: models.Cycle) -> {}:
"""
from
lofar.sas.tmss.tmss.workflowapp.models.schedulingunitflow
import
SchedulingUnitProcess
result
=
{
'
target
'
:
'
0.65
'
}
# TODO: Default efficiency is 65%. Change it properly when it will be implemented.
result
=
{
'
target
'
:
0.65
}
# TODO: Default efficiency is 65%. Change it properly when it will be implemented.
efficiency_per_day
=
0
# Get SchedulingUnitBlueprints related to the cycle
...
...
@@ -95,6 +95,8 @@ def _get_average_efficiency(cycle: models.Cycle) -> {}:
result
[
'
efficiency
'
]
=
efficiency_per_day
/
i
if
efficiency_per_day
>
0
else
None
return
result
import
logging
logger
=
logging
.
getLogger
()
def
_get_completion_level
(
cycle
:
models
.
Cycle
)
->
{}:
"""
...
...
@@ -103,22 +105,25 @@ def _get_completion_level(cycle: models.Cycle) -> {}:
from
lofar.sas.tmss.tmss.workflowapp.models.schedulingunitflow
import
SchedulingUnitProcess
# TODO: Change it properly when it will be implemented.
result
=
{
'
target
'
:
'
0.0
'
}
result
=
{
'
target
'
:
0.0
}
# Get SchedulingUnitBlueprints related to the cycle
subs
=
models
.
SchedulingUnitBlueprint
.
objects
.
filter
(
draft__scheduling_set__project__cycles
=
cycle
.
pk
)
total
=
0
total_succeeded
=
0
total
,
total_succeeded
=
0
,
0
for
sub
in
subs
:
# Aggregate total and successful durations
if
sub
.
observed_duration
:
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
# 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
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