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
473d46a1
Commit
473d46a1
authored
6 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
OSB-32
: changed query parameter name, and configured the controller to reply correctly to request
parent
9bfb531e
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
+37
-35
37 additions, 35 deletions
...Maintenance/DBInterface/monitoringdb/views/controllers.py
with
37 additions
and
35 deletions
LCU/Maintenance/DBInterface/monitoringdb/views/controllers.py
+
37
−
35
View file @
473d46a1
...
...
@@ -124,7 +124,7 @@ class ControllerStationOverview(ValidableReadOnlyView):
errors_only
=
'
true
'
n_station_tests
=
4
n_rtsm
=
4
error
s
_type
=
[]
error_type
s
=
[]
fields
=
[
coreapi
.
Field
(
...
...
@@ -160,7 +160,7 @@ class ControllerStationOverview(ValidableReadOnlyView):
description
=
'
displays or not only the station with more than one error
'
)
),
coreapi
.
Field
(
"
error
s
_type
"
,
"
error_type
s
"
,
required
=
False
,
location
=
'
query
'
,
type
=
parse_array
,
...
...
@@ -193,8 +193,8 @@ class ControllerStationOverview(ValidableReadOnlyView):
station_test_payload
=
OrderedDict
()
component_errors
=
station_test
.
component_errors
selected_component_errors
=
component_errors
if
(
self
.
error
s
_type
):
selected_component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error
s
_type
)
if
(
self
.
error_type
s
):
selected_component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error_type
s
)
station_test_payload
[
'
total_component_errors
'
]
=
selected_component_errors
.
count
()
station_test_payload
[
'
start_datetime
'
]
=
station_test
.
start_datetime
...
...
@@ -229,13 +229,14 @@ class ControllerStationOverview(ValidableReadOnlyView):
unique_modes
=
[
item
[
'
mode
'
]
for
item
in
rtsm
.
errors_summary
.
values
(
'
mode
'
).
distinct
()]
rtsm_payload
[
'
mode
'
]
=
unique_modes
rtsm_payload
[
'
total_component_errors
'
]
=
rtsm
.
errors_summary
.
count
()
errors_summary
=
OrderedDict
()
selected_rtsm_errors
=
rtsm
.
errors_summary
if
(
self
.
errors_type
):
selected_rtsm_errors
=
rtsm
.
errors_summary
.
filter
(
error_type__in
=
self
.
errors_type
)
if
(
self
.
error_types
):
selected_rtsm_errors
=
rtsm
.
errors_summary
.
filter
(
error_type__in
=
self
.
error_types
)
rtsm_payload
[
'
total_component_errors
'
]
=
selected_rtsm_errors
.
count
()
errors_summary
=
OrderedDict
()
errors_summary_query
=
selected_rtsm_errors
.
values
(
'
error_type
'
).
annotate
(
total
=
Count
(
'
error_type
'
))
...
...
@@ -262,7 +263,7 @@ class ControllerStationTestsSummary(ValidableReadOnlyView):
station_group
=
'
A
'
errors_only
=
'
true
'
lookback_time
=
7
error
s
_type
=
[]
error_type
s
=
[]
fields
=
[
coreapi
.
Field
(
...
...
@@ -289,7 +290,7 @@ class ControllerStationTestsSummary(ValidableReadOnlyView):
minimum
=
1
)
),
coreapi
.
Field
(
"
error
s
_type
"
,
"
error_type
s
"
,
required
=
False
,
location
=
'
query
'
,
type
=
parse_array
,
...
...
@@ -315,19 +316,19 @@ class ControllerStationTestsSummary(ValidableReadOnlyView):
for
station_test
in
station_test_list
:
station_test_payload
=
OrderedDict
()
component_errors
=
station_test
.
component_errors
station_test_payload
[
'
station_name
'
]
=
station_test
.
station
.
name
selected_component_errors
=
station_test
.
component_errors
if
(
self
.
errors_type
):
selected_component_errors
.
filter
(
type__in
=
self
.
errors_type
)
if
(
self
.
error_types
):
selected_component_errors
=
selected_component_errors
.
filter
(
type__in
=
self
.
error_types
)
station_test_payload
[
'
total_component_errors
'
]
=
s
tation_test
.
component_errors
.
count
()
'
total_component_errors
'
]
=
s
elected_
component_errors
.
count
()
station_test_payload
[
'
date
'
]
=
station_test
.
start_datetime
.
strftime
(
'
%Y-%m-%d
'
)
station_test_payload
[
'
start_datetime
'
]
=
station_test
.
start_datetime
station_test_payload
[
'
end_datetime
'
]
=
station_test
.
end_datetime
station_test_payload
[
'
checks
'
]
=
station_test
.
checks
component_errors_summary
=
component_errors
.
\
component_errors_summary
=
selected_
component_errors
.
\
values
(
'
component__type
'
,
'
type
'
).
annotate
(
total
=
Count
(
'
type
'
)).
order_by
(
'
-total
'
)
component_errors_summary_dict
=
OrderedDict
()
...
...
@@ -359,7 +360,7 @@ class ControllerLatestObservations(ValidableReadOnlyView):
station_group
=
'
A
'
errors_only
=
'
true
'
error
s
_type
=
[]
error_type
s
=
[]
fields
=
[
coreapi
.
Field
(
...
...
@@ -386,7 +387,7 @@ class ControllerLatestObservations(ValidableReadOnlyView):
description
=
'
select rtsm from date (ex. YYYY-MM-DD)
'
)
),
coreapi
.
Field
(
"
error
s
_type
"
,
"
error_type
s
"
,
required
=
False
,
location
=
'
query
'
,
type
=
parse_array
,
...
...
@@ -417,8 +418,8 @@ class ControllerLatestObservations(ValidableReadOnlyView):
.
annotate
(
total
=
Count
(
'
errors_summary__error_type
'
))
\
.
order_by
(
'
observation_id
'
,
'
station__name
'
)
if
self
.
error
s
_type
:
errors_summary
=
errors_summary
.
filter
(
errors_summary__error_type__in
=
self
.
error
s
_type
)
if
self
.
error_type
s
:
errors_summary
=
errors_summary
.
filter
(
errors_summary__error_type__in
=
self
.
error_type
s
)
response
=
dict
()
for
error_summary
in
errors_summary
:
...
...
@@ -467,7 +468,7 @@ class ControllerStationTestStatistics(ValidableReadOnlyView):
description
=
"
Statistical summary of both or either the station test and RTSM
"
station_group
=
'
A
'
test_type
=
'
B
'
error
s
_type
=
[]
error_type
s
=
[]
fields
=
[
coreapi
.
Field
(
...
...
@@ -510,7 +511,7 @@ class ControllerStationTestStatistics(ValidableReadOnlyView):
description
=
'
averaging interval in days
'
)
),
coreapi
.
Field
(
"
error
s
_type
"
,
"
error_type
s
"
,
required
=
False
,
location
=
'
query
'
,
type
=
parse_array
,
...
...
@@ -530,9 +531,9 @@ class ControllerStationTestStatistics(ValidableReadOnlyView):
component_errors
=
component_errors
.
filter
(
station_test__station__type
=
station_group
)
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
observation__station__type
=
station_group
)
if
self
.
error
s
_type
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error
s
_type
)
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
error_type__in
=
self
.
error
s
_type
)
if
self
.
error_type
s
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error_type
s
)
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
error_type__in
=
self
.
error_type
s
)
station_test_results
=
[]
rtsm_results
=
[]
...
...
@@ -584,9 +585,9 @@ class ControllerStationTestStatistics(ValidableReadOnlyView):
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
observation__station__type
=
station_group
)
if
self
.
error
s
_type
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error
s
_type
)
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
error_type__in
=
self
.
error
s
_type
)
if
self
.
error_type
s
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error_type
s
)
rtsm_summary_errors
=
rtsm_summary_errors
.
filter
(
error_type__in
=
self
.
error_type
s
)
if
test_type
in
[
'
S
'
,
'
B
'
]:
station_test_results
=
component_errors
.
\
...
...
@@ -667,6 +668,7 @@ class ControllerAllComponentErrorTypes(ValidableReadOnlyView):
data
=
[
item
[
'
type
'
]
for
item
in
ComponentError
.
objects
.
values
(
'
type
'
).
distinct
()]
return
Response
(
status
=
status
.
HTTP_200_OK
,
data
=
data
)
class
ControllerStationComponentErrors
(
ValidableReadOnlyView
):
description
=
"
Provides a summary per station of the component errors
"
# required parameters
...
...
@@ -675,7 +677,7 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
to_date
=
None
# optional parameters
test_type
=
'
B
'
error
s
_type
=
[]
error_type
s
=
[]
fields
=
[
coreapi
.
Field
(
...
...
@@ -707,7 +709,7 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
)
),
coreapi
.
Field
(
"
error
s
_type
"
,
"
error_type
s
"
,
required
=
False
,
location
=
'
query
'
,
type
=
parse_array
,
...
...
@@ -726,7 +728,7 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
.
filter
(
start_datetime__gte
=
self
.
from_date
,
end_datetime__lte
=
self
.
to_date
)
failing_component_types
=
station_tests
.
distinct
(
'
component_errors__component__type
'
).
values_list
(
'
component_errors__component__type
'
)
failing_component_types
=
station_tests
.
distinct
(
'
component_errors__component__type
'
).
exclude
(
component_errors__component__type__isnull
=
True
).
values_list
(
'
component_errors__component__type
'
)
for
failing_component_type
in
failing_component_types
:
failing_component_type
=
failing_component_type
[
0
]
...
...
@@ -743,8 +745,8 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
test_summary
[
'
component_errors
'
]
=
component_errors_dict
component_errors
=
station_test
.
component_errors
\
.
filter
(
component__type
=
failing_component_type
)
if
self
.
error
s
_type
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error
s
_type
)
if
self
.
error_type
s
:
component_errors
=
component_errors
.
filter
(
type__in
=
self
.
error_type
s
)
for
component_error
in
component_errors
:
component_id
=
component_error
.
component
.
component_id
...
...
@@ -855,8 +857,8 @@ class ControllerStationComponentErrors(ValidableReadOnlyView):
'
stop_frequency
'
,
'
percentage
'
,
'
error_type
'
,
'
count
'
,
'
rcu
'
)
if
self
.
error
s
_type
:
component_errors
=
component_errors
.
filter
(
error_type__in
=
self
.
error
s
_type
)
if
self
.
error_type
s
:
component_errors
=
component_errors
.
filter
(
error_type__in
=
self
.
error_type
s
)
for
component_error
in
component_errors
:
component_id
=
component_error
[
'
rcu
'
]
details
=
dict
(
percentage
=
component_error
[
'
percentage
'
],
...
...
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