Skip to content
GitLab
Explore
Sign in
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
cab89305
Commit
cab89305
authored
2 months ago
by
Reinder Kraaij
Browse files
Options
Downloads
Plain Diff
Merge branch 'Add-Logging-for-RPC' into 'master'
Add Logging See merge request
!1069
parents
e1dad5e3
4fb6e81a
No related branches found
No related tags found
1 merge request
!1069
Add Logging
Pipeline
#112701
failed
2 months ago
Stage: prepare
Stage: lint
Stage: test
Stage: package
Stage: images
Stage: integration
Stage: deploy
Pipeline: tango
#112702
Changes
3
Pipelines
8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+3
-0
3 additions, 0 deletions
.gitlab-ci.yml
tangostationcontrol/rpc/antennafield.py
+27
-8
27 additions, 8 deletions
tangostationcontrol/rpc/antennafield.py
tests/rpc/test_antennafield.py
+3
-3
3 additions, 3 deletions
tests/rpc/test_antennafield.py
with
33 additions
and
11 deletions
.gitlab-ci.yml
+
3
−
0
View file @
cab89305
...
...
@@ -127,6 +127,9 @@ run_unit_tests_coverage:
package_files
:
stage
:
package
needs
:
-
trigger_prepare
artifacts
:
expire_in
:
1w
paths
:
...
...
This diff is collapsed.
Click to expand it.
tangostationcontrol/rpc/antennafield.py
+
27
−
8
View file @
cab89305
...
...
@@ -43,13 +43,33 @@ class AntennaField(antennafield_pb2_grpc.AntennafieldServicer):
family
=
antenna_field_family_name
(
identifier
.
antennafield_name
)
db
=
tango
.
Database
()
device_exported
=
db
.
get_device_exported_for_class
(
family
)
logger
.
info
(
"
Create_antennafield_device_proxy ANTENNA=%s FIELD=%s FAMILY=%s
"
,
identifier
.
antenna_name
,
identifier
.
antennafield_name
,
family
,
)
for
device_name
in
device_exported
:
_
,
_
,
exported_antenna_name
=
device_name
.
split
(
"
/
"
)
_
,
_
,
exported_antennafield_name
=
device_name
.
split
(
"
/
"
)
logger
.
info
(
"
Found a device name in device_exported ANTENNA=%s FIELD=%s FAMILY=%s DEVICE_NAME=%s EXPORTED_ANTENNAFIELD_NAME=%s
"
,
identifier
.
antenna_name
,
identifier
.
antennafield_name
,
family
,
device_name
,
exported_antennafield_name
,
)
if
(
exported_antenna_name
.
casefold
()
==
identifier
.
antenna_name
.
casefold
()
exported_antenna
field
_name
.
casefold
()
==
identifier
.
antenna
field
_name
.
casefold
()
):
logger
.
info
(
"
We have a Match. ANTENNA=%s FIELD=%s FAMILY=%s DEVICE_NAME=%s
"
,
identifier
.
antenna_name
,
identifier
.
antennafield_name
,
family
,
device_name
,
)
return
create_device_proxy
(
device_name
,
write_access
=
write_access
)
except
Exception
as
ex
:
logger
.
exception
(
...
...
@@ -62,9 +82,8 @@ class AntennaField(antennafield_pb2_grpc.AntennafieldServicer):
raise
IOError
(
f
"
Failed to create device proxy to
'
{
identifier
.
antennafield_name
}
'"
)
from
ex
else
:
raise
ValueError
(
f
"
Antenna in Antenna fiel
d not foun
d
'
{
identifier
.
antennafield_name
}
'"
f
"
Antenna
'
{
identifier
.
antenna_name
}
'
in Antenna field
'
{
identifier
.
antennafield_name
}
'
not found
"
)
def
_get_antenna_index
(
...
...
This diff is collapsed.
Click to expand it.
tests/rpc/test_antennafield.py
+
3
−
3
View file @
cab89305
...
...
@@ -18,8 +18,8 @@ class TestAntennaField(base.TestCase):
mock_db
=
MagicMock
()
mock_tango_database
.
return_value
=
mock_db
mock_db
.
get_device_exported_for_class
.
return_value
=
[
"
STAT/AFL/
Antenna1
"
,
"
STAT/AFL/
Antenna2
"
,
# This should match the identifier
"
STAT/AFL/
LBA
"
,
"
STAT/AFL/
HBA
"
,
# This should match the identifier
]
return
mock_db
...
...
@@ -42,7 +42,7 @@ class TestAntennaField(base.TestCase):
# Assert
mock_create_device_proxy
.
assert_called_once_with
(
"
STAT/AFL/
Antenna2
"
,
write_access
=
True
"
STAT/AFL/
LBA
"
,
write_access
=
True
)
self
.
assertEqual
(
result
,
mock_device
)
...
...
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