Skip to content
GitLab
Explore
Sign in
Register
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
61e5c959
Commit
61e5c959
authored
3 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Use () syntax behind wrappers for consistency with Tango/SKA wrappers
parent
1cc99173
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Resolve #2021 "03 16 branched from master elk stack"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/src/hardware_device.py
+2
-2
2 additions, 2 deletions
devices/src/hardware_device.py
devices/src/lofar_logging.py
+12
-9
12 additions, 9 deletions
devices/src/lofar_logging.py
with
14 additions
and
11 deletions
devices/src/hardware_device.py
+
2
−
2
View file @
61e5c959
...
...
@@ -61,7 +61,7 @@ class hardware_device(Device):
self
.
value_dict
=
{
i
:
i
.
initial_value
()
for
i
in
self
.
attr_list
()}
@log_exceptions
@log_exceptions
()
def
init_device
(
self
):
"""
Instantiates the device in the OFF state.
"""
...
...
@@ -165,7 +165,7 @@ class hardware_device(Device):
"""
Method always executed before any TANGO command is executed.
"""
pass
@log_exceptions
@log_exceptions
()
def
delete_device
(
self
):
"""
Hook to delete resources allocated in init_device.
...
...
This diff is collapsed.
Click to expand it.
devices/src/lofar_logging.py
+
12
−
9
View file @
61e5c959
...
...
@@ -54,15 +54,18 @@ def device_logging_to_python(log_extra: dict = None):
return
inner
def
log_exceptions
(
func
):
def
log_exceptions
():
"""
Decorator that logs all exceptions that the function raises.
"""
@wraps
(
func
)
def
inner
(
self
,
*
args
,
**
kwargs
):
try
:
return
func
(
self
,
*
args
,
**
kwargs
)
except
Exception
as
e
:
self
.
error_stream
(
"
Caught exception: %s: %s
"
,
e
.
__class__
.
__name__
,
e
,
exc_info
=
1
)
raise
e
def
wrapper
(
func
):
@wraps
(
func
)
def
inner
(
self
,
*
args
,
**
kwargs
):
try
:
return
func
(
self
,
*
args
,
**
kwargs
)
except
Exception
as
e
:
self
.
error_stream
(
"
Caught exception: %s: %s
"
,
e
.
__class__
.
__name__
,
e
,
exc_info
=
1
)
raise
e
return
inner
return
inner
return
wrapper
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