This commit is contained in:
Miroslav Stampar 2016-01-27 21:25:34 +01:00
parent ee0439cf11
commit 954b4ec32b

View File

@ -177,10 +177,10 @@ class Task(object):
def engine_kill(self):
if self.process:
try:
self.process.kill()
return self.process.wait()
else:
return None
except:
pass
def engine_get_id(self):
if self.process:
@ -391,11 +391,10 @@ def task_flush(taskid):
"""
Flush task spool (delete all tasks)
"""
if is_admin(taskid):
DataStore.tasks = dict()
else:
for key in list(DataStore.tasks):
if DataStore.tasks[key].remote_addr == request.remote_addr:
if is_admin(taskid) or DataStore.tasks[key].remote_addr == request.remote_addr:
DataStore.tasks[key].engine_kill()
del DataStore.tasks[key]
logger.debug("[%s] Flushed task pool (%s)" % (taskid, "admin" if is_admin(taskid) else request.remote_addr))