added logs for task execution debugging
This commit is contained in:
parent
bbcca82704
commit
b93b2aee50
3 changed files with 15 additions and 3 deletions
|
|
@ -114,7 +114,9 @@ def main():
|
|||
logger.error(msg)
|
||||
exit()
|
||||
|
||||
TaskExecutor.Instance()
|
||||
task = TaskExecutor.Instance()
|
||||
logger.debug("blah")
|
||||
#logger.debug("task executor instance :%s", str(task))
|
||||
|
||||
job_count = 0
|
||||
for layout in lin_conf.get_enabled_layouts():
|
||||
|
|
|
|||
|
|
@ -115,8 +115,11 @@ class LinspectorJob:
|
|||
for task in member.get_tasks():
|
||||
if self.status.lower() in task.get_task_type().lower():
|
||||
logger.debug("Executing Task of type: " + self.status)
|
||||
TaskExecutor.Instance().schedule_task(job_information, task)
|
||||
try:
|
||||
|
||||
TaskExecutor.Instance().schedule_task(job_information, task)
|
||||
except Exception, e:
|
||||
logger.error("Error while executing: " + str(e))
|
||||
def handle_call(self):
|
||||
logger.debug("handle call")
|
||||
logger.debug(self.service)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class Task(object):
|
|||
@Singleton
|
||||
class TaskExecutor(object):
|
||||
def __init__(self):
|
||||
logger.debug("init taskExecutor")
|
||||
self.event = Event()
|
||||
self.taskInfos = []
|
||||
task_thread = Thread(target=self._run_worker_thread)
|
||||
|
|
@ -88,18 +89,22 @@ class TaskExecutor(object):
|
|||
def _run_worker_thread(self):
|
||||
while self.is_running() or not self.is_instant_end():
|
||||
if len(self.taskInfos) == 0:
|
||||
logger.debug("waiting for jobs to add")
|
||||
self.event.clear()
|
||||
self.event.wait()
|
||||
logger.debug("Task Executor waked up")
|
||||
|
||||
try:
|
||||
logger.debug("trying to get task information")
|
||||
msg, task = self.taskInfos[0]
|
||||
del self.taskInfos[0]
|
||||
if task:
|
||||
logger.debug("Starting Task Execution...")
|
||||
logger.debug("Starting Task Execution of task: %s", str(task))
|
||||
task.execute(msg)
|
||||
|
||||
except Exception, e:
|
||||
logger.error("Error " + str(e))
|
||||
logger.debug("shutting down TaskExecutor!")
|
||||
|
||||
def is_instant_end(self):
|
||||
return self._instantEnd
|
||||
|
|
@ -117,5 +122,7 @@ class TaskExecutor(object):
|
|||
self.event.set()
|
||||
|
||||
def schedule_task(self, msg, task):
|
||||
logger.debug("appending task '%s' for msg: %s", str(task), str(msg))
|
||||
self.taskInfos.append((msg, task))
|
||||
logger.debug("%s task stored", str(len(self.taskInfos)))
|
||||
self.event.set()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue