From f1c99e7ccec5c2843079993f4f113a917483d0f6 Mon Sep 17 00:00:00 2001 From: SKAJohanVenter <aventer@ska.ac.za> Date: Mon, 11 Oct 2021 18:02:58 +0200 Subject: [PATCH] SAR-276 Hiding queue_manager properties behind the component_manager --- src/ska_tango_base/base/base_device.py | 10 ++--- src/ska_tango_base/base/component_manager.py | 47 ++++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/ska_tango_base/base/base_device.py b/src/ska_tango_base/base/base_device.py index 77d057d1..73eaaee9 100644 --- a/src/ska_tango_base/base/base_device.py +++ b/src/ska_tango_base/base/base_device.py @@ -1120,7 +1120,7 @@ class SKABaseDevice(Device): :return: tasks in the device queue """ - return self.component_manager.queue_manager.tasks_in_queue + return self.component_manager.tasks_in_queue def read_longRunningCommandIDsInQueue(self): # PROTECTED REGION ID(SKABaseDevice.longRunningCommandIDsInQueue_read) ENABLED START # @@ -1138,7 +1138,7 @@ class SKABaseDevice(Device): :return: ID, status pairs of the currently executing commands """ - return self.component_manager.queue_manager.task_status + return self.component_manager.task_status def read_longRunningCommandProgress(self): # PROTECTED REGION ID(SKABaseDevice.longRunningCommandProgress_read) ENABLED START # @@ -1147,7 +1147,7 @@ class SKABaseDevice(Device): :return: ID, progress of the currently executing command. """ - return self.component_manager.queue_manager.task_progress + return self.component_manager.task_progress def read_longRunningCommandResult(self): # PROTECTED REGION ID(SKABaseDevice.longRunningCommandResult_read) ENABLED START # @@ -1156,9 +1156,9 @@ class SKABaseDevice(Device): :return: ID, ResultCode, result. """ - if not self.component_manager.queue_manager.task_result: + if not self.component_manager.task_result: return [] - return list(self.component_manager.queue_manager.task_result) + return list(self.component_manager.task_result) # -------- # Commands diff --git a/src/ska_tango_base/base/component_manager.py b/src/ska_tango_base/base/component_manager.py index 9061b457..ce3eacd0 100644 --- a/src/ska_tango_base/base/component_manager.py +++ b/src/ska_tango_base/base/component_manager.py @@ -126,6 +126,53 @@ class BaseComponentManager: """ raise NotImplementedError("BaseComponentManager is abstract.") + @property + def tasks_in_queue(self): + """ + Read the long running commands in the queue. + + :return: tasks in the device queue + """ + return self.queue_manager.tasks_in_queue + + @property + def task_ids_in_queue(self): + """ + Read the IDs of the long running commands in the queue. + + :return: unique ids for the enqueued commands + """ + return self.queue_manager.task_ids_in_queue + + @property + def task_status(self): + """ + Read the status of the currently executing long running commands. + + :return: ID, status pairs of the currently executing commands + """ + return self.queue_manager.task_status + + @property + def task_progress(self): + """ + Read the progress of the currently executing long running command. + + :return: ID, progress of the currently executing command. + """ + return self.queue_manager.task_progress + + @property + def task_result(self): + """ + Read the result of the completed long running command. + + :return: ID, ResultCode, result. + """ + if not self.queue_manager.task_result: + return [] + return list(self.queue_manager.task_result) + def off(self): """Turn the component off.""" raise NotImplementedError("BaseComponentManager is abstract.") -- GitLab