Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lmc-base-classes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LOFAR2.0
lmc-base-classes
Commits
847accb6
Unverified
Commit
847accb6
authored
Oct 25, 2021
by
SKAJohanVenter
Browse files
Options
Downloads
Patches
Plain Diff
SAR-288
Changed isCapabilityAchievable to long running
parent
5c4d1561
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ska_tango_base/base/base_device.py
+4
-4
4 additions, 4 deletions
src/ska_tango_base/base/base_device.py
src/ska_tango_base/controller_device.py
+6
-4
6 additions, 4 deletions
src/ska_tango_base/controller_device.py
tests/test_controller_device.py
+7
-2
7 additions, 2 deletions
tests/test_controller_device.py
with
17 additions
and
10 deletions
src/ska_tango_base/base/base_device.py
+
4
−
4
View file @
847accb6
...
@@ -1184,7 +1184,7 @@ class SKABaseDevice(Device):
...
@@ -1184,7 +1184,7 @@ class SKABaseDevice(Device):
@command
(
@command
(
dtype_out
=
"
DevVarLongStringArray
"
,
dtype_out
=
"
DevVarLongStringArray
"
,
doc_out
=
"
(Re
turnTyp
e,
'
Command unique ID
'
)
"
,
doc_out
=
"
(Re
sultCod
e,
'
Command unique ID
'
)
"
,
)
)
@DebugIt
()
@DebugIt
()
def
GetVersionInfo
(
self
):
def
GetVersionInfo
(
self
):
...
@@ -1195,11 +1195,11 @@ class SKABaseDevice(Device):
...
@@ -1195,11 +1195,11 @@ class SKABaseDevice(Device):
To modify behaviour for this command, modify the do() method of
To modify behaviour for this command, modify the do() method of
the command class.
the command class.
:return:
Version details of the device.
:return:
The result code and the command unique ID
"""
"""
command
=
self
.
get_command_object
(
"
GetVersionInfo
"
)
command
=
self
.
get_command_object
(
"
GetVersionInfo
"
)
unique_id
,
re
turn
_code
=
self
.
component_manager
.
enqueue
(
command
)
unique_id
,
re
sult
_code
=
self
.
component_manager
.
enqueue
(
command
)
return
[[
re
turn
_code
],
[
unique_id
]]
return
[[
re
sult
_code
],
[
unique_id
]]
# PROTECTED REGION END # // SKABaseDevice.GetVersionInfo
# PROTECTED REGION END # // SKABaseDevice.GetVersionInfo
class
ResetCommand
(
StateModelCommand
,
ResponseCommand
):
class
ResetCommand
(
StateModelCommand
,
ResponseCommand
):
...
...
This diff is collapsed.
Click to expand it.
src/ska_tango_base/controller_device.py
+
6
−
4
View file @
847accb6
...
@@ -240,7 +240,8 @@ class SKAController(SKABaseDevice):
...
@@ -240,7 +240,8 @@ class SKAController(SKABaseDevice):
@command
(
@command
(
dtype_in
=
"
DevVarLongStringArray
"
,
dtype_in
=
"
DevVarLongStringArray
"
,
doc_in
=
"
[nrInstances][Capability types]
"
,
doc_in
=
"
[nrInstances][Capability types]
"
,
dtype_out
=
"
bool
"
,
dtype_out
=
"
DevVarLongStringArray
"
,
doc_out
=
"
(ResultCode,
'
Command unique ID
'
)
"
,
)
)
@DebugIt
()
@DebugIt
()
def
isCapabilityAchievable
(
self
,
argin
):
def
isCapabilityAchievable
(
self
,
argin
):
...
@@ -258,11 +259,12 @@ class SKAController(SKABaseDevice):
...
@@ -258,11 +259,12 @@ class SKAController(SKABaseDevice):
:type argin: :py:class:`tango.DevVarLongStringArray`.
:type argin: :py:class:`tango.DevVarLongStringArray`.
:return:
True if capability can be achieved, False if cannot
:return:
result_code, unique_id
:rtype: Dev
Boolean
:rtype: Dev
VarLongStringArray
"""
"""
command
=
self
.
get_command_object
(
"
IsCapabilityAchievable
"
)
command
=
self
.
get_command_object
(
"
IsCapabilityAchievable
"
)
return
command
(
argin
)
unique_id
,
result_code
=
self
.
component_manager
.
enqueue
(
command
,
argin
)
return
[[
result_code
],
[
unique_id
]]
# PROTECTED REGION END # // SKAController.isCapabilityAchievable
# PROTECTED REGION END # // SKAController.isCapabilityAchievable
...
...
This diff is collapsed.
Click to expand it.
tests/test_controller_device.py
+
7
−
2
View file @
847accb6
...
@@ -108,7 +108,10 @@ class TestSKAController(object):
...
@@ -108,7 +108,10 @@ class TestSKAController(object):
def
test_isCapabilityAchievable_failure
(
self
,
device_under_test
):
def
test_isCapabilityAchievable_failure
(
self
,
device_under_test
):
"""
Test for isCapabilityAchievable to test failure condition.
"""
"""
Test for isCapabilityAchievable to test failure condition.
"""
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_failure) ENABLED START #
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_failure) ENABLED START #
assert
device_under_test
.
isCapabilityAchievable
([[
2
],
[
"
BAND1
"
]])
is
False
device_under_test
.
isCapabilityAchievable
([[
2
],
[
"
BAND1
"
]])
capability_achievalble
=
device_under_test
.
longRunningCommandResult
[
2
]
assert
capability_achievalble
==
"
False
"
# assert device_under_test.isCapabilityAchievable([[2], ["BAND1"]]) is False
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_failure
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_failure
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success_decorators) ENABLED START #
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success_decorators) ENABLED START #
...
@@ -117,7 +120,9 @@ class TestSKAController(object):
...
@@ -117,7 +120,9 @@ class TestSKAController(object):
def
test_isCapabilityAchievable_success
(
self
,
device_under_test
):
def
test_isCapabilityAchievable_success
(
self
,
device_under_test
):
"""
Test for isCapabilityAchievable to test success condition.
"""
"""
Test for isCapabilityAchievable to test success condition.
"""
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success) ENABLED START #
# PROTECTED REGION ID(SKAController.test_isCapabilityAchievable_success) ENABLED START #
assert
device_under_test
.
isCapabilityAchievable
([[
1
],
[
"
BAND1
"
]])
is
True
device_under_test
.
isCapabilityAchievable
([[
1
],
[
"
BAND1
"
]])
capability_achievalble
=
device_under_test
.
longRunningCommandResult
[
2
]
assert
capability_achievalble
==
"
True
"
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_success
# PROTECTED REGION END # // SKAController.test_isCapabilityAchievable_success
# PROTECTED REGION ID(SKAController.test_elementLoggerAddress_decorators) ENABLED START #
# PROTECTED REGION ID(SKAController.test_elementLoggerAddress_decorators) ENABLED START #
...
...
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