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
836bdf0d
Commit
836bdf0d
authored
3 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-659
: improve code
parent
0099ed02
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!273
Resolve L2SS-659 "Compute archiving load"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/toolkit/archiver_util.py
+15
-18
15 additions, 18 deletions
...ationcontrol/tangostationcontrol/toolkit/archiver_util.py
with
15 additions
and
18 deletions
tangostationcontrol/tangostationcontrol/toolkit/archiver_util.py
+
15
−
18
View file @
836bdf0d
...
@@ -7,6 +7,20 @@
...
@@ -7,6 +7,20 @@
from
tango
import
DeviceProxy
,
CmdArgType
from
tango
import
DeviceProxy
,
CmdArgType
import
re
import
re
"""
A dictionary whose keys are the Tango datatypes mapping, and the values are the relative byte size
See reference https://tango-controls.readthedocs.io/en/latest/development/advanced/reference.html#tango-data-type
and https://www.tutorialspoint.com/cplusplus/cpp_data_types.htm
TODO: manage String attributes
"""
DATATYPES_SIZE_DICT
=
{
CmdArgType
.
DevBoolean
:
1
,
CmdArgType
.
DevShort
:
2
,
CmdArgType
.
DevLong
:
8
,
CmdArgType
.
DevFloat
:
4
,
CmdArgType
.
DevDouble
:
8
,
CmdArgType
.
DevUShort
:
2
,
CmdArgType
.
DevULong
:
8
,
CmdArgType
.
DevString
:
20
,
CmdArgType
.
DevVarCharArray
:
None
,
CmdArgType
.
DevVarShortArray
:
None
,
CmdArgType
.
DevVarLongArray
:
None
,
CmdArgType
.
DevVarFloatArray
:
None
,
CmdArgType
.
DevVarDoubleArray
:
None
,
CmdArgType
.
DevVarUShortArray
:
None
,
CmdArgType
.
DevVarULongArray
:
None
,
CmdArgType
.
DevVarStringArray
:
None
,
CmdArgType
.
DevVarLongStringArray
:
None
,
CmdArgType
.
DevVarDoubleStringArray
:
None
,
CmdArgType
.
DevState
:
3
,
CmdArgType
.
ConstDevString
:
None
,
CmdArgType
.
DevVarBooleanArray
:
None
,
CmdArgType
.
DevUChar
:
1
,
CmdArgType
.
DevLong64
:
8
,
CmdArgType
.
DevULong64
:
8
,
CmdArgType
.
DevVarLong64Array
:
None
,
CmdArgType
.
DevVarULong64Array
:
None
,
CmdArgType
.
DevInt
:
4
,
CmdArgType
.
DevEncoded
:
None
,
CmdArgType
.
DevEnum
:
None
,
CmdArgType
.
DevPipeBlob
:
None
}
def
get_db_config
(
device_name
:
str
)
->
dict
:
def
get_db_config
(
device_name
:
str
)
->
dict
:
"""
"""
Retrieve the DB credentials from the Tango properties of Configuration Manager or EventSubscribers
Retrieve the DB credentials from the Tango properties of Configuration Manager or EventSubscribers
...
@@ -105,28 +119,11 @@ def retrieve_attributes_from_wildcards(device_name: str, matching_list: list):
...
@@ -105,28 +119,11 @@ def retrieve_attributes_from_wildcards(device_name: str, matching_list: list):
matched_list
.
append
(
a
)
matched_list
.
append
(
a
)
return
matched_list
return
matched_list
def
DATATYPES_SIZE_DICT
()
->
dict
:
"""
Return a dictionary whose keys are the Tango datatypes mapping, and the values are the relative byte size
See reference https://tango-controls.readthedocs.io/en/latest/development/advanced/reference.html#tango-data-type
and https://www.tutorialspoint.com/cplusplus/cpp_data_types.htm
TODO: manage String attributes
"""
datatypes_dict
=
{
CmdArgType
.
DevBoolean
:
1
,
CmdArgType
.
DevShort
:
2
,
CmdArgType
.
DevLong
:
8
,
CmdArgType
.
DevFloat
:
4
,
CmdArgType
.
DevDouble
:
8
,
CmdArgType
.
DevUShort
:
2
,
CmdArgType
.
DevULong
:
8
,
CmdArgType
.
DevString
:
20
,
CmdArgType
.
DevVarCharArray
:
None
,
CmdArgType
.
DevVarShortArray
:
None
,
CmdArgType
.
DevVarLongArray
:
None
,
CmdArgType
.
DevVarFloatArray
:
None
,
CmdArgType
.
DevVarDoubleArray
:
None
,
CmdArgType
.
DevVarUShortArray
:
None
,
CmdArgType
.
DevVarULongArray
:
None
,
CmdArgType
.
DevVarStringArray
:
None
,
CmdArgType
.
DevVarLongStringArray
:
None
,
CmdArgType
.
DevVarDoubleStringArray
:
None
,
CmdArgType
.
DevState
:
3
,
CmdArgType
.
ConstDevString
:
None
,
CmdArgType
.
DevVarBooleanArray
:
None
,
CmdArgType
.
DevUChar
:
1
,
CmdArgType
.
DevLong64
:
8
,
CmdArgType
.
DevULong64
:
8
,
CmdArgType
.
DevVarLong64Array
:
None
,
CmdArgType
.
DevVarULong64Array
:
None
,
CmdArgType
.
DevInt
:
4
,
CmdArgType
.
DevEncoded
:
None
,
CmdArgType
.
DevEnum
:
None
,
CmdArgType
.
DevPipeBlob
:
None
}
return
datatypes_dict
def
get_size_from_datatype
(
datatype
:
int
)
->
int
:
def
get_size_from_datatype
(
datatype
:
int
)
->
int
:
"""
"""
Return the number of bytes for a given Tango datatype
Return the number of bytes for a given Tango datatype
"""
"""
datatypes_dict
=
DATATYPES_SIZE_DICT
()
try
:
try
:
return
datatypes_dict
[
datatype
]
return
DATATYPES_SIZE_DICT
[
datatype
]
except
IndexError
:
except
IndexError
:
return
1
return
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