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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
aab8ea26
Commit
aab8ea26
authored
1 year ago
by
Corné Lukken
Browse files
Options
Downloads
Plain Diff
Merge branch '
L2SS-1741
' into 'master'
L2SS-1741
: Prevent bypassing state checks in async devices Closes
L2SS-1741
See merge request
!846
parents
5bd0d41f
d82b99a7
No related branches found
No related tags found
1 merge request
!846
L2SS-1741: Prevent bypassing state checks in async devices
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
+6
-10
6 additions, 10 deletions
...tationcontrol/devices/base_device_classes/lofar_device.py
with
6 additions
and
10 deletions
tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
+
6
−
10
View file @
aab8ea26
...
...
@@ -45,10 +45,7 @@ from tangostationcontrol.common.lofar_logging import (
device_logging_to_python
,
)
from
tangostationcontrol.common.proxy
import
create_device_proxy
from
tangostationcontrol.common.states
import
(
DEFAULT_COMMAND_STATES
,
INITIALISED_STATES
,
)
from
tangostationcontrol.common.states
import
DEFAULT_COMMAND_STATES
from
tangostationcontrol.common.type_checking
import
sequence_not_str
from
tangostationcontrol.devices.base_device_classes.control_hierarchy
import
(
ControlHierarchyDevice
,
...
...
@@ -220,7 +217,7 @@ class LOFARDevice(Device):
def
is_attribute_access_allowed
(
self
,
req_type
:
AttReqType
):
"""
Returns whether an attribute wrapped by the AttributeWrapper be accessed.
"""
return
self
.
get_state
()
in
INITIALISE
D_STATES
return
self
.
get_state
()
in
DEFAULT_COMMAN
D_STATES
# TODO(Corne): Actually implement locking in L2SS-940
def
atomic_read_modify_write_attribute
(
...
...
@@ -405,6 +402,7 @@ class LOFARDevice(Device):
# Commands
# --------
@only_in_states
([
DevState
.
OFF
])
def
_Initialise
(
self
):
"""
Command to ask for initialisation of this device. Can only be called in OFF state.
...
...
@@ -443,11 +441,11 @@ class LOFARDevice(Device):
@command
()
@debugit
()
@log_exceptions
()
@only_in_states
([
DevState
.
OFF
])
@fault_on_error
()
def
Initialise
(
self
):
self
.
_Initialise
()
@only_in_states
(
DEFAULT_COMMAND_STATES
)
def
_On
(
self
):
if
self
.
get_state
()
==
DevState
.
ON
:
# Already on. Don't complain.
...
...
@@ -462,7 +460,6 @@ class LOFARDevice(Device):
@command
()
@debugit
()
@log_exceptions
()
@only_in_states
(
INITIALISED_STATES
)
@fault_on_error
()
def
On
(
self
):
"""
...
...
@@ -658,7 +655,6 @@ class LOFARDevice(Device):
f
"
Cannot assign default to attribute
{
attribute
}
"
)
from
_e
@only_in_states
(
INITIALISED_STATES
)
@command
()
@debugit
()
@log_exceptions
()
...
...
@@ -668,7 +664,6 @@ class LOFARDevice(Device):
# This is just the command version of _prepare_hardware().
self
.
_power_hardware_on
()
@only_in_states
(
INITIALISED_STATES
)
@command
()
@debugit
()
@log_exceptions
()
...
...
@@ -698,6 +693,7 @@ class LOFARDevice(Device):
restart_python
()
logger
.
error
(
"
Failed to restart Device Server
"
)
@only_in_states
([
DevState
.
OFF
])
def
_boot
(
self
):
# setup connections
self
.
_Initialise
()
...
...
@@ -708,7 +704,6 @@ class LOFARDevice(Device):
# make device available
self
.
_On
()
@only_in_states
([
DevState
.
OFF
])
@command
()
def
boot
(
self
):
self
.
_boot
()
...
...
@@ -720,6 +715,7 @@ class LOFARDevice(Device):
before configuring the hardware.
"""
pass
@only_in_states
(
DEFAULT_COMMAND_STATES
)
def
_power_hardware_off
(
self
):
"""
Override this method to disable any hardware related to the device.
"""
pass
...
...
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