From 53a5705177f12a6b80051366a9d6c1997262b62f Mon Sep 17 00:00:00 2001 From: Firmlyzhu Date: Fri, 29 Mar 2019 18:23:21 +0800 Subject: [PATCH] fix some bugs --- src/master/jobmgr.py | 3 ++- src/master/taskmgr.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/master/jobmgr.py b/src/master/jobmgr.py index 1cbf1eb..c66f6cf 100644 --- a/src/master/jobmgr.py +++ b/src/master/jobmgr.py @@ -293,7 +293,7 @@ class JobMgr(): def stop_job(self, user, job_id): logger.info("[jobmgr] stop job(id:%s) user(%s)"%(job_id, user)) if job_id not in self.job_map.keys(): - return [False,"Job id %s does not exists! Maybe it has been finished."] + return [False,"Job id %s does not exists! Maybe it has been finished."%job_id] try: job = self.job_map[job_id] if job.job_db.status == 'done' or job.job_db.status == 'failed': @@ -304,6 +304,7 @@ class JobMgr(): taskid = job_id + '_' + task_idx self.taskmgr.lazy_stop_task(taskid) job.stop_job() + del self.job_map[job_id] except Exception as err: logger.error(traceback.format_exc()) #logger.error(err) diff --git a/src/master/taskmgr.py b/src/master/taskmgr.py index 90b296b..17355d5 100644 --- a/src/master/taskmgr.py +++ b/src/master/taskmgr.py @@ -297,7 +297,7 @@ class TaskMgr(threading.Thread): def stop_subtask(self, subtask): try: - self.logger.info('[task_processor] Stoping task [%s] vnode [%d]' % (subtask.vnode_info.taskid, subtask.vnode_info.vnodeid)) + self.logger.info('[task_processor] Stopping task [%s] vnode [%d]' % (subtask.vnode_info.taskid, subtask.vnode_info.vnodeid)) channel = grpc.insecure_channel('%s:%s' % (subtask.worker, self.worker_port)) stub = WorkerStub(channel) response = stub.stop_task(subtask.command_info) @@ -423,7 +423,7 @@ class TaskMgr(threading.Thread): self.stop_vnode(sub_task) #pass - @data_lock('task_stop_lock') + @data_lock('stop_lock') def lazy_stop_task(self, taskid): self.lazy_stop_list.append(taskid)