Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
ArchiveExtractor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
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
DG
ArchiveExtractor
Commits
8f5a872f
Commit
8f5a872f
authored
3 years ago
by
System User
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit env
parent
8fddde59
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
env_tango.py
+112
-0
112 additions, 0 deletions
env_tango.py
with
112 additions
and
0 deletions
env_tango.py
0 → 100644
+
112
−
0
View file @
8f5a872f
import
PyTango
as
tango
import
re
# =============================================================================
# The following attributes will be populated when first needed.
# =============================================================================
# List of attributes tangopath in TDB
TDBLIST
=
[]
# List of attributes tangopath in TDB
HDBLIST
=
[]
# List of tango devices
DEVLIST
=
[]
###############################################################################
## USEFULL FUNCTION
###############################################################################
def
searchattr
(
prx
,
attr
,
ignorecase
=
True
):
"""
Search in a tango device proxy for an attribute name.
PARAMETERS
----------
prx: tango.DeviceProxy
Proxy to the device.
attr: string
String to search for.
ignorecase: bool
Case insensitive.
"""
if
ignorecase
:
return
[
a
for
a
in
prx
.
get_attribute_list
()
if
attr
.
lower
()
in
a
.
lower
()]
else
:
return
[
a
for
a
in
prx
.
get_attribute_list
()
if
attr
in
a
]
def
searcharch
(
attr
,
db
,
ignorecase
=
True
):
"""
Search for an attribute in the archiver list.
PARAMETERS
----------
attr: string
String to search for.
db: string
Which database,
"
H
"
,
"
T
"
ignorecase: bool
Case insensitive.
RETURNS
-------
"""
global
ARCHLIST
if
ARCHLIST
is
None
:
# Populate archlist
ARCHLIST
=
dict
()
for
db
in
"
HT
"
:
ARCHLIST
[
db
]
=
tango
.
DeviceProxy
(
"
archiving/{}dbextractor/1
"
.
format
(
db
)).
getcurrentarchivedatt
()
if
ignorecase
:
return
[
a
for
a
in
ARCHLIST
[
db
]
if
attr
.
lower
()
in
a
.
lower
()]
else
:
return
[
a
for
a
in
prx
.
get_attribute_list
()
if
attr
in
a
]
###############################################################################
## POPULATE ATTRIBUTE FUNCTIONS
###############################################################################
# =============================================================================
def
populate_tdblist
():
"""
Fill the global list of TDB archived attributes.
"""
global
TDBLIST
TDBLIST
=
tango
.
DeviceProxy
(
"
archiving/tdbextractor/1
"
).
getcurrentarchivedatt
()
# =============================================================================
def
populate_hdblist
():
"""
Fill the global list of HDB archived attributes.
"""
global
HDBLIST
HDBLIST
=
tango
.
DeviceProxy
(
"
archiving/hdbextractor/1
"
).
getcurrentarchivedatt
()
# =============================================================================
def
populate_devlist
():
"""
Fill the global list of devices.
"""
DB
=
tango
.
Database
()
for
domain
in
DB
.
get_device_domain
(
"
*
"
):
for
family
in
DB
.
get_device_family
(
domain
+
"
/*
"
):
for
member
in
DB
.
get_device_member
(
domain
+
"
/
"
+
family
+
"
/*
"
):
DEVLIST
.
append
(
domain
+
"
/
"
+
family
+
"
/
"
+
member
)
# =============================================================================
def
populate_devlist2
():
"""
Fill the global list of devices.
"""
DB
=
tango
.
Database
()
DEVLIST
=
[
dev
for
dev
in
DB
.
get_device_exported
(
"
*
"
)]
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