tasking_lib: Add get last task name function

This commit is contained in:
Arthur Golubtsov
2019-11-19 12:10:55 +00:00
parent 1a038f95f1
commit 4da20fa9c7

View File

@@ -41,6 +41,8 @@ class TaskManager(object):
self._task_interrupt_event = threading.Event()
self._shutdown_event = threading.Event()
self._last_task = None
self._timeshift = 0.0
def add_task(self, timestamp, priority, task_function,
@@ -85,6 +87,9 @@ class TaskManager(object):
return heapq.heappop(self.task_queue)
raise KeyError('Pop from an empty priority queue')
def get_last_task_name(self):
return self._last_task
def start(self):
#print("Task manager is started")
logger.info("Task manager is started")
@@ -187,6 +192,7 @@ class TaskManager(object):
self.pop_task()
except KeyError as e:
logger.error(str(e))
self._last_task = task.func.__name__
#try:
#print("Pop {} function!".format(task.func.__name__))
#except Exception as e: