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
7ef27b76
Unverified
Commit
7ef27b76
authored
Oct 20, 2021
by
SKAJohanVenter
Browse files
Options
Downloads
Patches
Plain Diff
SAR-276
Made queue_manager private in component manager
parent
a5d22e66
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ska_tango_base/base/component_manager.py
+9
-9
9 additions, 9 deletions
src/ska_tango_base/base/component_manager.py
tests/long_running_tasks/test_task_queue_manager.py
+10
-10
10 additions, 10 deletions
tests/long_running_tasks/test_task_queue_manager.py
with
19 additions
and
19 deletions
src/ska_tango_base/base/component_manager.py
+
9
−
9
View file @
7ef27b76
...
...
@@ -54,7 +54,7 @@ class BaseComponentManager:
manager
"""
self
.
op_state_model
=
op_state_model
self
.
queue_manager
=
self
.
create_queue_manager
()
self
.
_
queue_manager
=
self
.
create_queue_manager
()
def
start_communicating
(
self
):
"""
...
...
@@ -126,7 +126,7 @@ class BaseComponentManager:
:return: tasks in the device queue
"""
return
self
.
queue_manager
.
tasks_in_queue
return
self
.
_
queue_manager
.
tasks_in_queue
@property
def
task_ids_in_queue
(
self
):
...
...
@@ -135,7 +135,7 @@ class BaseComponentManager:
:return: unique ids for the enqueued commands
"""
return
self
.
queue_manager
.
task_ids_in_queue
return
self
.
_
queue_manager
.
task_ids_in_queue
@property
def
task_status
(
self
):
...
...
@@ -144,7 +144,7 @@ class BaseComponentManager:
:return: ID, status pairs of the currently executing commands
"""
return
self
.
queue_manager
.
task_status
return
self
.
_
queue_manager
.
task_status
@property
def
task_progress
(
self
):
...
...
@@ -153,7 +153,7 @@ class BaseComponentManager:
:return: ID, progress of the currently executing command.
"""
return
self
.
queue_manager
.
task_progress
return
self
.
_
queue_manager
.
task_progress
@property
def
task_result
(
self
):
...
...
@@ -162,7 +162,7 @@ class BaseComponentManager:
:return: ID, ResultCode, result.
"""
return
list
(
self
.
queue_manager
.
task_result
)
return
list
(
self
.
_
queue_manager
.
task_result
)
def
off
(
self
):
"""
Turn the component off.
"""
...
...
@@ -232,12 +232,12 @@ class BaseComponentManager:
:return: The unique ID of the queued command and the ResultCode
:rtype: tuple
"""
return
self
.
queue_manager
.
enqueue_task
(
task
,
argin
=
argin
)
return
self
.
_
queue_manager
.
enqueue_task
(
task
,
argin
=
argin
)
def
abort_tasks
(
self
)
->
None
:
"""
Start aborting tasks on the queue.
"""
self
.
queue_manager
.
abort_tasks
()
self
.
_
queue_manager
.
abort_tasks
()
def
get_task_state
(
self
,
unique_id
:
str
)
->
TaskState
:
"""
Attempt to get state of QueueTask.
"""
return
self
.
queue_manager
.
get_task_state
(
unique_id
)
return
self
.
_
queue_manager
.
get_task_state
(
unique_id
)
This diff is collapsed.
Click to expand it.
tests/long_running_tasks/test_task_queue_manager.py
+
10
−
10
View file @
7ef27b76
...
...
@@ -411,14 +411,14 @@ class TestQueueManagerExit:
while
not
cm
.
task_status
:
time
.
sleep
(
0.1
)
# Start aborting
cm
.
queue_manager
.
abort_tasks
()
cm
.
_
queue_manager
.
abort_tasks
()
# Wait for the exit
while
not
cm
.
task_result
:
time
.
sleep
(
0.1
)
# aborting state should be cleaned up since the queue is empty and
# nothing is in progress
while
cm
.
queue_manager
.
is_aborting
:
while
cm
.
_
queue_manager
.
is_aborting
:
time
.
sleep
(
0.1
)
# When aborting this should be rejected
...
...
@@ -426,11 +426,11 @@ class TestQueueManagerExit:
cm
.
enqueue
(
slow_task
())
cm
.
enqueue
(
slow_task
())
assert
not
cm
.
queue_manager
.
is_aborting
assert
not
cm
.
_
queue_manager
.
is_aborting
# Abort tasks
cm
.
queue_manager
.
abort_tasks
()
cm
.
_
queue_manager
.
abort_tasks
()
assert
cm
.
queue_manager
.
is_aborting
assert
cm
.
_
queue_manager
.
is_aborting
# Load up some tasks that should be aborted
cm
.
enqueue
(
slow_task
())
...
...
@@ -443,8 +443,8 @@ class TestQueueManagerExit:
time
.
sleep
(
0.1
)
# Resume the commands
cm
.
queue_manager
.
resume_tasks
()
assert
not
cm
.
queue_manager
.
is_aborting
cm
.
_
queue_manager
.
resume_tasks
()
assert
not
cm
.
_
queue_manager
.
is_aborting
# Wait for my slow command to finish
unique_id
,
_
=
cm
.
enqueue
(
slow_task
())
...
...
@@ -473,13 +473,13 @@ class TestQueueManagerExit:
time
.
sleep
(
0.1
)
# Stop all threads
cm
.
queue_manager
.
stop_tasks
()
cm
.
_
queue_manager
.
stop_tasks
()
# Wait for the exit
while
not
cm
.
task_result
:
time
.
sleep
(
0.5
)
# Wait for all the workers to stop
while
any
([
worker
.
is_alive
()
for
worker
in
cm
.
queue_manager
.
_threads
]):
while
any
([
worker
.
is_alive
()
for
worker
in
cm
.
_
queue_manager
.
_threads
]):
time
.
sleep
(
0.1
)
@pytest.mark.forked
...
...
@@ -504,7 +504,7 @@ class TestQueueManagerExit:
cm
.
enqueue
(
stop_task
())
cm
.
enqueue
(
abort_task
())
del
cm
.
queue_manager
del
cm
.
_
queue_manager
del
cm
...
...
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