Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
4323f17b
Commit
4323f17b
authored
2 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-1030
: improve code
parent
2c225b80
Branches
Branches containing commit
No related tags found
1 merge request
!468
Resolve L2SS-1030 "Create configuration device"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/tangostationcontrol/common/configuration.py
+11
-12
11 additions, 12 deletions
...tationcontrol/tangostationcontrol/common/configuration.py
tangostationcontrol/tangostationcontrol/devices/boot.py
+1
-1
1 addition, 1 deletion
tangostationcontrol/tangostationcontrol/devices/boot.py
with
12 additions
and
13 deletions
tangostationcontrol/tangostationcontrol/common/configuration.py
+
11
−
12
View file @
4323f17b
...
@@ -26,26 +26,25 @@ def get_db_data(db, tangodb_timeout:int = 10000):
...
@@ -26,26 +26,25 @@ def get_db_data(db, tangodb_timeout:int = 10000):
# Create empty dictionaries to be populated
# Create empty dictionaries to be populated
devices_dict
=
{}
devices_dict
=
{}
server_dict
=
{}
server_dict
=
{}
# Query TangoDb with built-in function for devices data
_
,
raw_result
=
dbproxy
.
command_inout
(
"
DbMySqlSelect
"
,
DEVICE_PROPERTIES_QUERY
)
# Remodel the query result
device_property_result
=
query_to_tuples
(
raw_result
,
3
)
# Populate devices dictionary from query data
# Populate devices dictionary from query data
device_property_result
=
query_tangodb
(
dbproxy
,
DEVICE_PROPERTIES_QUERY
,
3
)
devices_dict
=
add_to_devices_dict
(
devices_dict
,
device_property_result
)
devices_dict
=
add_to_devices_dict
(
devices_dict
,
device_property_result
)
# Query TangoDb with built-in function for attributes data
_
,
raw_result
=
dbproxy
.
command_inout
(
"
DbMySqlSelect
"
,
ATTRS_PROPERTIES_QUERY
)
# Remodel the query result
attrs_property_result
=
query_to_tuples
(
raw_result
,
4
)
# Populate devices dictionary from query data
# Populate devices dictionary from query data
attrs_property_result
=
query_tangodb
(
dbproxy
,
ATTRS_PROPERTIES_QUERY
,
4
)
devices_dict
=
add_to_attrs_dict
(
devices_dict
,
attrs_property_result
)
devices_dict
=
add_to_attrs_dict
(
devices_dict
,
attrs_property_result
)
# Query TangoDb with built-in function for server data
_
,
raw_result
=
dbproxy
.
command_inout
(
"
DbMySqlSelect
"
,
SERVER_QUERY
)
# Remodel the query result
server_result
=
query_to_tuples
(
raw_result
,
3
)
# Populate server dictionary from query data and merge it with devices dict
# Populate server dictionary from query data and merge it with devices dict
server_result
=
query_tangodb
(
dbproxy
,
SERVER_QUERY
,
3
)
server_dict
=
add_to_server_dict
(
server_dict
,
devices_dict
,
server_result
)
server_dict
=
add_to_server_dict
(
server_dict
,
devices_dict
,
server_result
)
return
{
"
servers
"
:
server_dict
}
return
{
"
servers
"
:
server_dict
}
def
query_tangodb
(
dbproxy
:
DeviceProxy
,
sql_query
:
str
,
num_cols
:
int
):
"""
Query TangoDb with a built-in function and return data as tuples
"""
_
,
raw_result
=
dbproxy
.
command_inout
(
"
DbMySqlSelect
"
,
sql_query
)
return
query_to_tuples
(
raw_result
,
num_cols
)
def
add_to_devices_dict
(
devices_dict
:
dict
,
result
:
list
):
def
add_to_devices_dict
(
devices_dict
:
dict
,
result
:
list
):
"""
Populate a devices dictionary with the following structure:
"""
Populate a devices dictionary with the following structure:
'
device_name
'
: {
'
properties
'
: {
'
property_name
'
: [
'
property_value
'
] } }
'
device_name
'
: {
'
properties
'
: {
'
property_name
'
: [
'
property_value
'
] } }
...
...
This diff is collapsed.
Click to expand it.
tangostationcontrol/tangostationcontrol/devices/boot.py
+
1
−
1
View file @
4323f17b
...
@@ -240,6 +240,7 @@ class Boot(lofar_device):
...
@@ -240,6 +240,7 @@ class Boot(lofar_device):
dtype
=
'
DevVarStringArray
'
,
dtype
=
'
DevVarStringArray
'
,
mandatory
=
False
,
mandatory
=
False
,
default_value
=
[
"
STAT/Docker/1
"
,
# Docker controls the device containers, so it goes before anything else
default_value
=
[
"
STAT/Docker/1
"
,
# Docker controls the device containers, so it goes before anything else
"
STAT/Configuration/1
"
,
# Configuration device loads and update station configuration
"
STAT/PSOC/1
"
,
# PSOC boot early to detect power delivery failure as fast as possible
"
STAT/PSOC/1
"
,
# PSOC boot early to detect power delivery failure as fast as possible
"
STAT/PCON/1
"
,
# PCON boot early because it is responsible for power delivery.
"
STAT/PCON/1
"
,
# PCON boot early because it is responsible for power delivery.
"
STAT/APSPU/1
"
,
# APS Power Units control other hardware we want to initialise
"
STAT/APSPU/1
"
,
# APS Power Units control other hardware we want to initialise
...
@@ -256,7 +257,6 @@ class Boot(lofar_device):
...
@@ -256,7 +257,6 @@ class Boot(lofar_device):
"
STAT/TileBeam/1
"
,
# Accesses AntennaField
"
STAT/TileBeam/1
"
,
# Accesses AntennaField
"
STAT/DigitalBeam/1
"
,
# Accessed SDP and Beamlet
"
STAT/DigitalBeam/1
"
,
# Accessed SDP and Beamlet
"
STAT/TemperatureManager/1
"
,
"
STAT/TemperatureManager/1
"
,
"
STAT/Configuration/1
"
,
],
],
)
)
...
...
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