Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-285-Cancel-execution-may-leave-running-processes 27ede8b13 -> 9ff17e744
terminating by task_id Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/9ff17e74 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/9ff17e74 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/9ff17e74 Branch: refs/heads/ARIA-285-Cancel-execution-may-leave-running-processes Commit: 9ff17e7443c3c384d6afccad881eecd95b95561c Parents: 27ede8b Author: max-orlov <[email protected]> Authored: Sun Jun 25 17:04:09 2017 +0300 Committer: max-orlov <[email protected]> Committed: Sun Jun 25 17:04:09 2017 +0300 ---------------------------------------------------------------------- aria/orchestrator/workflows/core/engine.py | 2 +- aria/orchestrator/workflows/executor/process.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ff17e74/aria/orchestrator/workflows/core/engine.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/workflows/core/engine.py b/aria/orchestrator/workflows/core/engine.py index 373abb8..5d6fcd7 100644 --- a/aria/orchestrator/workflows/core/engine.py +++ b/aria/orchestrator/workflows/core/engine.py @@ -80,7 +80,7 @@ class Engine(logger.LoggerMixin): def _terminate_tasks(self, tasks): for task in tasks: - self._executors[task._executor].terminate(task) + self._executors[task._executor].terminate(task.id) @staticmethod def cancel_execution(ctx): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ff17e74/aria/orchestrator/workflows/executor/process.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py index 56241f6..0600b6a 100644 --- a/aria/orchestrator/workflows/executor/process.py +++ b/aria/orchestrator/workflows/executor/process.py @@ -120,9 +120,8 @@ class ProcessExecutor(base.BaseExecutor): self._server_socket.close() self._listener_thread.join(timeout=60) - def terminate(self, task): - # We need to retrieve the wrapped task (which includes the proc and the ctx) - task = self._tasks.get(task.id) + def terminate(self, task_id): + task = self._tasks.get(task_id) # The process might have managed to finished so it would not be in the tasks list if task and os.getsid(os.getpid()) != os.getpgid(task.proc.pid): # If the above condition is false, the process group leader is the group leader
