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
65b9110b
Commit
65b9110b
authored
6 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
OSB-32
: finished implementation of the station based list of errors
parent
4313627b
No related branches found
No related tags found
2 merge requests
!89
Monitoring maintenance Epic branch merge
,
!1
Resolve OSB-13 "Monitoringmaintenance "
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LCU/Maintenance/DBInterface/monitoringdb/views/controllers.py
+35
-14
35 additions, 14 deletions
...Maintenance/DBInterface/monitoringdb/views/controllers.py
with
35 additions
and
14 deletions
LCU/Maintenance/DBInterface/monitoringdb/views/controllers.py
+
35
−
14
View file @
65b9110b
...
...
@@ -642,7 +642,7 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
end_datetime__lte
=
self
.
to_date
)
failing_component_types
=
station_tests
.
distinct
(
'
component_errors__component__type
'
).
values_list
(
'
component_errors__component__type
'
)
print
(
failing_component_types
)
for
failing_component_type
in
failing_component_types
:
failing_component_type
=
failing_component_type
[
0
]
component_type_errors_list
=
list
()
...
...
@@ -673,19 +673,25 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
def
collect_rtsm_errors
(
self
):
station_entry
=
Station
.
objects
.
filter
(
name
=
self
.
station_name
).
first
()
response_payload
=
OrderedDict
()
print
(
dir
(
station_entry
))
rtsm_observations
=
station_entry
.
rtsmobservation_set
\
.
filter
(
start_datetime__gte
=
self
.
from_date
,
end_datetime__lte
=
self
.
to_date
)
print
(
rtsm_observations
)
failing_component_modes
=
rtsm_observations
.
distinct
(
failing_component_modes
=
rtsm_observations
.
exclude
(
errors_summary__isnull
=
True
).
distinct
(
'
errors_summary__mode
'
).
values_list
(
'
errors_summary__mode
'
)
for
observing_mode
in
failing_component_modes
:
observing_mode
=
observing_mode
[
0
]
rtsm_errors_per_component_type
=
list
()
response_payload
[
MODE_TO_COMPONENT
[
observing_mode
]]
=
rtsm_errors_per_component_type
for
rtsm_observation
in
rtsm_observations
.
order_by
(
'
-start_datetime
'
):
rtsm_summary
=
OrderedDict
()
rtsm_errors_per_component_type
.
append
(
rtsm_summary
)
rtsm_summary
[
'
test_type
'
]
=
'
R
'
rtsm_summary
[
'
start_date
'
]
=
rtsm_observation
.
start_datetime
rtsm_summary
[
'
end_date
'
]
=
rtsm_observation
.
end_datetime
...
...
@@ -696,22 +702,37 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
.
filter
(
mode
=
observing_mode
)
\
.
values
(
'
error_type
'
,
'
start_frequency
'
,
'
stop_frequency
'
,
'
percentage
'
,
'
error_type
'
,
'
samples
'
,
'
count
'
,
'
rcu
'
)
'
error_type
'
,
'
count
'
,
'
rcu
'
)
for
component_error
in
component_errors
:
component_id
=
component_error
[
'
rcu
'
]
percentage
=
component_error
[
'
percentage
'
]
start_frequency
=
component_error
[
'
start_frequency
'
]
stop_frequency
=
component_error
[
'
stop_frequency
'
]
details
=
dict
(
percentage
=
component_error
[
'
percentage
'
],
start_frequency
=
component_error
[
'
start_frequency
'
],
stop_frequency
=
component_error
[
'
stop_frequency
'
],
count
=
component_error
[
'
count
'
])
error_type
=
component_error
[
'
error_type
'
]
#TODO I AM HERE
if
component_id
not
in
component_errors
:
component_errors_dict
[
str
(
component_id
)]
=
list
()
component_errors_dict
[
str
(
component_id
)]
+=
[
dict
(
error_type
=
error_type
,
details
=
details
)]
return
response_payload
print
(
dir
(
component_error
))
def
compute_response
(
self
):
self
.
from_date
=
parse_date
(
self
.
from_date
)
self
.
to_date
=
parse_date
(
self
.
to_date
)
station_test_errors
=
{}
rtsm_errors
=
{}
if
self
.
test_type
in
[
'
S
'
,
'
B
'
]:
station_test_errors
=
self
.
collect_station_test_errors
()
if
self
.
test_type
in
[
'
R
'
,
'
B
'
]:
rtsm_errors
=
self
.
collect_rtsm_errors
()
payload
=
OrderedDict
()
for
component_type
in
set
(
rtsm_errors
.
keys
()
|
station_test_errors
.
keys
()):
station_test_errors_per_type
=
station_test_errors
.
get
(
component_type
,
[])
rtsm_errors_per_type
=
rtsm_errors
.
get
(
component_type
,
[])
station_test_errors
=
self
.
collect_station_test_errors
()
rtsm_errors
=
self
.
collect_rtsm_errors
()
payload
[
component_type
]
=
sorted
(
station_test_errors_per_type
+
rtsm_errors_per_type
,
key
=
lambda
item
:
item
[
'
start_date
'
])
return
Response
(
status
=
status
.
HTTP_200_OK
,
data
=
station_test_errors
)
\ No newline at end of file
return
Response
(
status
=
status
.
HTTP_200_OK
,
data
=
payload
)
\ No newline at end of file
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