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
94945a28
Commit
94945a28
authored
4 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
changed back to put_nowait and added queue percentage MP
parent
d6437b2d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!50
Resolve L2SS-188 "2021 05 27 branched from master udp recv sst client"
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
devices/Statistics.py
+1
-0
1 addition, 0 deletions
devices/Statistics.py
devices/clients/sst_client.py
+6
-1
6 additions, 1 deletion
devices/clients/sst_client.py
jupyter-notebooks/test_device.ipynb
+9
-8
9 additions, 8 deletions
jupyter-notebooks/test_device.ipynb
with
16 additions
and
9 deletions
devices/Statistics.py
+
1
−
0
View file @
94945a28
...
...
@@ -49,6 +49,7 @@ class SST(hardware_device):
# Example: comms_annotation={"parameter": "this_value_R"}
packet_count_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
packet_count_R
"
},
datatype
=
numpy
.
int64
)
last_packet_timestamp_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
last_packet_timestamp_R
"
},
datatype
=
numpy
.
int64
)
queue_percentage_used_R
=
attribute_wrapper
(
comms_annotation
=
{
"
parameter
"
:
"
queue_percentage_used_R
"
},
datatype
=
numpy
.
double
)
# --------
# overloaded functions
...
...
This diff is collapsed.
Click to expand it.
devices/clients/sst_client.py
+
6
−
1
View file @
94945a28
import
queue
from
threading
import
Thread
import
socket
from
util.comms_client
import
CommClient
...
...
@@ -134,6 +135,8 @@ class UDP_Receiver(Thread):
except
socket
.
timeout
:
pass
except
queue
.
Full
:
pass
def
__del__
(
self
):
self
.
stream_on
=
False
...
...
@@ -149,7 +152,8 @@ class SST(Thread):
self
.
parameters
=
{
"
packet_count_R
"
:
numpy
.
int64
(
0
),
"
last_packet_timestamp_R
"
:
numpy
.
int64
(
0
)
"
last_packet_timestamp_R
"
:
numpy
.
int64
(
0
),
"
queue_percentage_used_R
"
:
numpy
.
double
(
100
*
self
.
queue
.
qsize
()
/
self
.
queue
.
maxsize
)
}
super
().
__init__
()
...
...
@@ -174,3 +178,4 @@ class SST(Thread):
def
process_packet
(
self
,
packet
):
self
.
parameters
[
"
packet_count_R
"
]
+=
1
self
.
parameters
[
"
last_packet_timestamp_R
"
]
=
numpy
.
int64
(
int
(
time
.
time
()))
self
.
parameters
[
"
queue_percentage_used_R
"
]
=
numpy
.
double
(
100
*
self
.
queue
.
qsize
()
/
self
.
queue
.
maxsize
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
jupyter-notebooks/test_device.ipynb
+
9
−
8
View file @
94945a28
...
...
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count":
1
,
"execution_count":
30
,
"id": "waiting-chance",
"metadata": {},
"outputs": [],
...
...
@@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 3
1
,
"id": "moving-alexandria",
"metadata": {},
"outputs": [],
...
...
@@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count":
4
,
"execution_count":
32
,
"id": "ranking-aluminum",
"metadata": {},
"outputs": [
...
...
@@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count":
8
,
"execution_count":
60
,
"id": "beneficial-evidence",
"metadata": {},
"outputs": [
...
...
@@ -59,10 +59,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"packet_count_R [80]\n",
"last_packet_timestamp_R [1623239037]\n",
"State <function __get_command_func.<locals>.f at 0x7fcb20e510d0>\n",
"Status <function __get_command_func.<locals>.f at 0x7fcb20e510d0>\n"
"packet_count_R [139917203]\n",
"last_packet_timestamp_R [1623248251]\n",
"queue_percentage_used_R [100.]\n",
"State <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>\n",
"Status <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>\n"
]
}
],
...
...
%% Cell type:code id:waiting-chance tags:
```
python
import
time
import
numpy
```
%% Cell type:code id:moving-alexandria tags:
```
python
d
=
DeviceProxy
(
"
LTS/SST/1
"
)
```
%% Cell type:code id:ranking-aluminum tags:
```
python
state
=
str
(
d
.
state
())
if
state
==
"
OFF
"
:
d
.
initialise
()
time
.
sleep
(
1
)
state
=
str
(
d
.
state
())
if
state
==
"
STANDBY
"
:
d
.
on
()
state
=
str
(
d
.
state
())
if
state
==
"
ON
"
:
print
(
"
Device is now in on state
"
)
```
%% Output
Device is now in on state
%% Cell type:code id:beneficial-evidence tags:
```
python
attr_names
=
d
.
get_attribute_list
()
for
i
in
attr_names
:
exec
(
"
value = print(i, d.{})
"
.
format
(
i
))
```
%% Output
packet_count_R [80]
last_packet_timestamp_R [1623239037]
State <function __get_command_func.<locals>.f at 0x7fcb20e510d0>
Status <function __get_command_func.<locals>.f at 0x7fcb20e510d0>
packet_count_R [139917203]
last_packet_timestamp_R [1623248251]
queue_percentage_used_R [100.]
State <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>
Status <function __get_command_func.<locals>.f at 0x7fcb20e68bf8>
%% Cell type:code id:sporting-current tags:
```
python
d
.
RCU_mask_RW
=
[
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,]
time
.
sleep
(
1
)
print
(
d
.
RCU_mask_RW
)
monitor_rate
=
d
.
RCU_monitor_rate_RW
print
(
"
current monitoring rate: {}, setting to {}
"
.
format
(
monitor_rate
,
monitor_rate
+
1
))
monitor_rate
=
monitor_rate
+
1
time
.
sleep
(
1
)
```
%% Output
3.0
%% Cell type:code id:sharing-mechanics tags:
```
python
``
`
%%
Cell
type
:
code
id
:
ruled
-
tracy
tags
:
```
python
```
...
...
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