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
4f325fd9
Commit
4f325fd9
authored
3 years ago
by
Mario Raciti
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-610
: Add telescope_time_distribution for cycles without yet any assigned category
parent
3334c12c
No related branches found
No related tags found
3 merge requests
!634
WIP: COBALT commissioning delta
,
!492
Resolve TMSS-610
,
!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
-7
10 additions, 7 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
with
10 additions
and
7 deletions
SAS/TMSS/backend/src/tmss/tmssapp/adapters/reports.py
+
10
−
7
View file @
4f325fd9
...
@@ -32,12 +32,13 @@ def _get_telescope_time_distribution(cycle: models.Cycle):
...
@@ -32,12 +32,13 @@ def _get_telescope_time_distribution(cycle: models.Cycle):
"""
"""
result
=
{}
result
=
{}
# Consider FILLER as
a
categor
y
# Consider
UNASSIGNED and
FILLER as categor
ies for the purposes of reporting
categories
=
[
'
FILLER
'
,]
+
[
c
for
c
in
models
.
ProjectCategory
.
Choices
]
categories
=
[
'
UNASSIGNED
'
,
'
FILLER
'
,]
+
[
c
for
c
in
models
.
ProjectCategory
.
Choices
]
for
c
in
categories
:
for
c
in
categories
:
total
,
succeeded
,
failed
=
0
,
0
,
0
total
,
succeeded
,
failed
=
0
,
0
,
0
projects
=
models
.
Project
.
objects
.
filter
(
cycles
=
cycle
,
project_category
=
c
.
value
)
if
c
!=
'
FILLER
'
\
projects
=
models
.
Project
.
objects
.
filter
(
cycles
=
cycle
,
project_category
=
c
.
value
)
if
(
c
!=
'
UNASSIGNED
'
and
c
!=
'
FILLER
'
)
\
else
models
.
Project
.
objects
.
filter
(
cycles
=
cycle
,
filler
=
True
)
else
models
.
Project
.
objects
.
filter
(
cycles
=
cycle
,
filler
=
True
)
if
c
==
'
FILLER
'
\
else
models
.
Project
.
objects
.
filter
(
cycles
=
cycle
,
project_category__isnull
=
True
)
for
p
in
projects
:
for
p
in
projects
:
# Get durations for single project and aggregate to get the totals
# Get durations for single project and aggregate to get the totals
_
,
durations
=
_get_subs_and_durations_from_project
(
p
)
_
,
durations
=
_get_subs_and_durations_from_project
(
p
)
...
@@ -45,14 +46,16 @@ def _get_telescope_time_distribution(cycle: models.Cycle):
...
@@ -45,14 +46,16 @@ def _get_telescope_time_distribution(cycle: models.Cycle):
succeeded
+=
durations
[
'
total_succeeded
'
]
succeeded
+=
durations
[
'
total_succeeded
'
]
failed
+=
durations
[
'
total_failed
'
]
failed
+=
durations
[
'
total_failed
'
]
idle
=
total
-
succeeded
-
failed
idle
=
total
-
succeeded
-
failed
result
[
c
.
name
if
c
!
=
'
FILLER
'
else
'
FILLER
'
]
=
{
'
durations
'
:
{
'
total
'
:
total
,
'
succeeded
'
:
succeeded
,
result
[
c
if
c
=
=
'
UNASSIGNED
'
or
c
==
'
FILLER
'
else
c
.
name
]
=
{
'
durations
'
:
{
'
total
'
:
total
,
'
succeeded
'
:
succeeded
,
'
failed
'
:
failed
,
'
idle
'
:
idle
}}
'
failed
'
:
failed
,
'
idle
'
:
idle
}}
return
result
return
result
def
_get_average_efficiency
(
cycle
:
models
.
Cycle
):
def
_get_average_efficiency
(
cycle
:
models
.
Cycle
):
return
0
result
=
{
'
efficiency
'
:
'
65%
'
}
# TODO: Default efficiency is 65%. Change it properly when it will be implemented.
return
result
def
_get_completion_level
(
cycle
:
models
.
Cycle
):
def
_get_completion_level
(
cycle
:
models
.
Cycle
):
...
@@ -72,7 +75,7 @@ def _get_observation_hours_per_category(cycle: models.Cycle):
...
@@ -72,7 +75,7 @@ def _get_observation_hours_per_category(cycle: models.Cycle):
subs
=
models
.
SchedulingUnitBlueprint
.
objects
.
filter
(
draft__scheduling_set__project__cycles
=
cycle
.
pk
).
filter
(
priority_queue
=
prio
.
value
)
subs
=
models
.
SchedulingUnitBlueprint
.
objects
.
filter
(
draft__scheduling_set__project__cycles
=
cycle
.
pk
).
filter
(
priority_queue
=
prio
.
value
)
for
sub
in
subs
:
for
sub
in
subs
:
result
[
'
total_duration_idle
'
]
+=
sub
.
duration
.
total_seconds
()
result
[
'
total_duration_idle
'
]
+=
sub
.
duration
.
total_seconds
()
if
sub
.
status
==
'
finished
'
:
if
sub
.
status
==
'
finished
'
:
# TODO: Use QA workflow flag instead of the finished status
result
[
f
'
total_duration_
{
prio
.
name
}
'
]
+=
sub
.
duration
.
total_seconds
()
result
[
f
'
total_duration_
{
prio
.
name
}
'
]
+=
sub
.
duration
.
total_seconds
()
if
sub
.
status
==
'
cancelled
'
:
if
sub
.
status
==
'
cancelled
'
:
result
[
'
total_duration_failed
'
]
+=
sub
.
duration
.
total_seconds
()
result
[
'
total_duration_failed
'
]
+=
sub
.
duration
.
total_seconds
()
...
...
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