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
4800240b
Commit
4800240b
authored
3 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-630
: fix statistics client functions
parent
167c8c9e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!296
Resolve L2SS-630 "Refactor functions graded c"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/clients/statistics_client.py
+14
-11
14 additions, 11 deletions
...ncontrol/tangostationcontrol/clients/statistics_client.py
with
14 additions
and
11 deletions
tangostationcontrol/tangostationcontrol/clients/statistics_client.py
+
14
−
11
View file @
4800240b
...
...
@@ -97,7 +97,7 @@ class StatisticsClient(AsyncCommClient):
# redirect to right object. this works as long as the parameter names are unique among them.
if
annotation
[
"
type
"
]
==
"
statistics
"
:
def
read_function
():
process_statistics_annotation
(
annotation
,
attribute
,
parameter
)
return
_
process_statistics_annotation
()
elif
annotation
[
"
type
"
]
==
"
udp
"
:
def
read_function
():
return
self
.
udp
.
parameters
[
parameter
]
...
...
@@ -111,17 +111,10 @@ class StatisticsClient(AsyncCommClient):
else
:
raise
ValueError
(
f
"
Unknown queue parameter requested:
{
parameter
}
"
)
elif
annotation
[
"
type
"
]
==
"
replicator
"
:
parameters_dict
=
{
"
clients
"
:
numpy
.
array
(
self
.
tcp
.
clients
(),
dtype
=
numpy
.
str
),
"
nof_bytes_sent
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_bytes_sent
),
"
nof_packets_sent
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_packets_sent
),
"
nof_tasks_pending
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_tasks_pending
)}
for
k
,
v
in
parameters_dict
.
items
():
if
parameter
==
k
:
def
read_function
():
return
v
raise
ValueError
(
f
"
Unknown replicator parameter requested:
{
parameter
}
"
)
return
_process_replicator_annotation
()
def
process_statistics_annotation
(
annotation
,
attribute
,
parameter
):
def
_
process_statistics_annotation
():
if
annotation
.
get
(
"
reshape
"
,
False
):
# force array into the shape of the attribute
if
attribute
.
dim_y
>
1
:
...
...
@@ -131,6 +124,16 @@ class StatisticsClient(AsyncCommClient):
else
:
return
self
.
collector
.
parameters
[
parameter
]
def
_process_replicator_annotation
():
parameters_dict
=
{
"
clients
"
:
numpy
.
array
(
self
.
tcp
.
clients
(),
dtype
=
numpy
.
str
),
"
nof_bytes_sent
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_bytes_sent
),
"
nof_packets_sent
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_packets_sent
),
"
nof_tasks_pending
"
:
numpy
.
uint64
(
self
.
tcp
.
nof_tasks_pending
)}
for
k
,
v
in
parameters_dict
.
items
():
if
parameter
==
k
:
return
v
raise
ValueError
(
f
"
Unknown replicator parameter requested:
{
parameter
}
"
)
def
write_function
(
value
):
"""
Not used here
...
...
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