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
d82b99a7
Commit
d82b99a7
authored
Feb 12, 2024
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-1741
: Prevent bypassing state checks in async devices
parent
5bd0d41f
Branches
Branches containing commit
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 @
d82b99a7
...
@@ -45,10 +45,7 @@ from tangostationcontrol.common.lofar_logging import (
...
@@ -45,10 +45,7 @@ from tangostationcontrol.common.lofar_logging import (
device_logging_to_python
,
device_logging_to_python
,
)
)
from
tangostationcontrol.common.proxy
import
create_device_proxy
from
tangostationcontrol.common.proxy
import
create_device_proxy
from
tangostationcontrol.common.states
import
(
from
tangostationcontrol.common.states
import
DEFAULT_COMMAND_STATES
DEFAULT_COMMAND_STATES
,
INITIALISED_STATES
,
)
from
tangostationcontrol.common.type_checking
import
sequence_not_str
from
tangostationcontrol.common.type_checking
import
sequence_not_str
from
tangostationcontrol.devices.base_device_classes.control_hierarchy
import
(
from
tangostationcontrol.devices.base_device_classes.control_hierarchy
import
(
ControlHierarchyDevice
,
ControlHierarchyDevice
,
...
@@ -220,7 +217,7 @@ class LOFARDevice(Device):
...
@@ -220,7 +217,7 @@ class LOFARDevice(Device):
def
is_attribute_access_allowed
(
self
,
req_type
:
AttReqType
):
def
is_attribute_access_allowed
(
self
,
req_type
:
AttReqType
):
"""
Returns whether an attribute wrapped by the AttributeWrapper be accessed.
"""
"""
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
# TODO(Corne): Actually implement locking in L2SS-940
def
atomic_read_modify_write_attribute
(
def
atomic_read_modify_write_attribute
(
...
@@ -405,6 +402,7 @@ class LOFARDevice(Device):
...
@@ -405,6 +402,7 @@ class LOFARDevice(Device):
# Commands
# Commands
# --------
# --------
@only_in_states
([
DevState
.
OFF
])
def
_Initialise
(
self
):
def
_Initialise
(
self
):
"""
"""
Command to ask for initialisation of this device. Can only be called in OFF state.
Command to ask for initialisation of this device. Can only be called in OFF state.
...
@@ -443,11 +441,11 @@ class LOFARDevice(Device):
...
@@ -443,11 +441,11 @@ class LOFARDevice(Device):
@command
()
@command
()
@debugit
()
@debugit
()
@log_exceptions
()
@log_exceptions
()
@only_in_states
([
DevState
.
OFF
])
@fault_on_error
()
@fault_on_error
()
def
Initialise
(
self
):
def
Initialise
(
self
):
self
.
_Initialise
()
self
.
_Initialise
()
@only_in_states
(
DEFAULT_COMMAND_STATES
)
def
_On
(
self
):
def
_On
(
self
):
if
self
.
get_state
()
==
DevState
.
ON
:
if
self
.
get_state
()
==
DevState
.
ON
:
# Already on. Don't complain.
# Already on. Don't complain.
...
@@ -462,7 +460,6 @@ class LOFARDevice(Device):
...
@@ -462,7 +460,6 @@ class LOFARDevice(Device):
@command
()
@command
()
@debugit
()
@debugit
()
@log_exceptions
()
@log_exceptions
()
@only_in_states
(
INITIALISED_STATES
)
@fault_on_error
()
@fault_on_error
()
def
On
(
self
):
def
On
(
self
):
"""
"""
...
@@ -658,7 +655,6 @@ class LOFARDevice(Device):
...
@@ -658,7 +655,6 @@ class LOFARDevice(Device):
f
"
Cannot assign default to attribute
{
attribute
}
"
f
"
Cannot assign default to attribute
{
attribute
}
"
)
from
_e
)
from
_e
@only_in_states
(
INITIALISED_STATES
)
@command
()
@command
()
@debugit
()
@debugit
()
@log_exceptions
()
@log_exceptions
()
...
@@ -668,7 +664,6 @@ class LOFARDevice(Device):
...
@@ -668,7 +664,6 @@ class LOFARDevice(Device):
# This is just the command version of _prepare_hardware().
# This is just the command version of _prepare_hardware().
self
.
_power_hardware_on
()
self
.
_power_hardware_on
()
@only_in_states
(
INITIALISED_STATES
)
@command
()
@command
()
@debugit
()
@debugit
()
@log_exceptions
()
@log_exceptions
()
...
@@ -698,6 +693,7 @@ class LOFARDevice(Device):
...
@@ -698,6 +693,7 @@ class LOFARDevice(Device):
restart_python
()
restart_python
()
logger
.
error
(
"
Failed to restart Device Server
"
)
logger
.
error
(
"
Failed to restart Device Server
"
)
@only_in_states
([
DevState
.
OFF
])
def
_boot
(
self
):
def
_boot
(
self
):
# setup connections
# setup connections
self
.
_Initialise
()
self
.
_Initialise
()
...
@@ -708,7 +704,6 @@ class LOFARDevice(Device):
...
@@ -708,7 +704,6 @@ class LOFARDevice(Device):
# make device available
# make device available
self
.
_On
()
self
.
_On
()
@only_in_states
([
DevState
.
OFF
])
@command
()
@command
()
def
boot
(
self
):
def
boot
(
self
):
self
.
_boot
()
self
.
_boot
()
...
@@ -720,6 +715,7 @@ class LOFARDevice(Device):
...
@@ -720,6 +715,7 @@ class LOFARDevice(Device):
before configuring the hardware.
"""
before configuring the hardware.
"""
pass
pass
@only_in_states
(
DEFAULT_COMMAND_STATES
)
def
_power_hardware_off
(
self
):
def
_power_hardware_off
(
self
):
"""
Override this method to disable any hardware related to the device.
"""
"""
Override this method to disable any hardware related to the device.
"""
pass
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