Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AttributeWrapper
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
AttributeWrapper
Commits
d07c93ae
Commit
d07c93ae
authored
5 months ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Do not go to FAULT on a read error
parent
6623e044
No related branches found
No related tags found
1 merge request
!11
Do not go to FAULT on a read error
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-1
2 additions, 1 deletion
README.md
attribute_wrapper/attribute_wrapper.py
+0
-2
0 additions, 2 deletions
attribute_wrapper/attribute_wrapper.py
attribute_wrapper/decorators.py
+0
-27
0 additions, 27 deletions
attribute_wrapper/decorators.py
with
2 additions
and
30 deletions
README.md
+
2
−
1
View file @
d07c93ae
...
@@ -43,6 +43,7 @@ This project is licensed under the Apache License Version 2.0
...
@@ -43,6 +43,7 @@ This project is licensed under the Apache License Version 2.0
## Releases
## Releases
-
0.3 - Do not go to FAULT if a read or write fails
-
0.3.1 - Do not go to FAULT if a read fails
-
0.3 - Do not go to FAULT if a write fails
-
0.2 - Ensure requirements.txt dependencies are installed
-
0.2 - Ensure requirements.txt dependencies are installed
-
0.1 - Initial release from separating into own repository
-
0.1 - Initial release from separating into own repository
This diff is collapsed.
Click to expand it.
attribute_wrapper/attribute_wrapper.py
+
0
−
2
View file @
d07c93ae
...
@@ -9,7 +9,6 @@ from tango import AttrWriteType, AttReqType
...
@@ -9,7 +9,6 @@ from tango import AttrWriteType, AttReqType
from
tango.server
import
attribute
from
tango.server
import
attribute
from
attribute_wrapper.attribute_io
import
AttributeIO
from
attribute_wrapper.attribute_io
import
AttributeIO
from
attribute_wrapper.decorators
import
fault_on_error
__all__
=
[
"
AttributeWrapper
"
]
__all__
=
[
"
AttributeWrapper
"
]
...
@@ -138,7 +137,6 @@ class AttributeWrapper(attribute):
...
@@ -138,7 +137,6 @@ class AttributeWrapper(attribute):
else
:
else
:
"""
Assign the read function to the attribute
"""
"""
Assign the read function to the attribute
"""
@fault_on_error
()
def
read_func_wrapper
(
device
):
def
read_func_wrapper
(
device
):
"""
"""
read_func_wrapper reads the attribute value, stores it and returns it
"
read_func_wrapper reads the attribute value, stores it and returns it
"
...
...
This diff is collapsed.
Click to expand it.
attribute_wrapper/decorators.py
deleted
100644 → 0
+
0
−
27
View file @
6623e044
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
import
logging
from
functools
import
wraps
__all__
=
[
"
fault_on_error
"
]
logger
=
logging
.
getLogger
()
def
fault_on_error
():
"""
Wrapper to catch exceptions. Sets the device in a FAULT state if any occurs.
"""
def
inner
(
func
):
@wraps
(
func
)
def
error_wrapper
(
device
,
*
args
,
**
kwargs
):
try
:
return
func
(
device
,
*
args
,
**
kwargs
)
except
Exception
as
e
:
logger
.
exception
(
"
Function failed.
"
)
device
.
Fault
(
f
"
FAULT in
{
func
.
__name__
}
:
{
e
.
__class__
.
__name__
}
:
{
e
}
"
)
raise
return
error_wrapper
return
inner
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