[AIRFLOW-844] Fix cgroups directory creation Testing Done: - Tested locally, we should add cgroup tests at some point though
Closes #2057 from aoen/ddavydov/fix_cgroups Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/0b477900 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/0b477900 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/0b477900 Branch: refs/heads/v1-8-stable Commit: 0b477900021e69f6a0ae8b5dd42b1465e9f836c5 Parents: ce3f88b Author: Dan Davydov <[email protected]> Authored: Mon Feb 6 16:21:05 2017 -0800 Committer: Bolke de Bruin <[email protected]> Committed: Tue Feb 7 21:49:23 2017 +0100 ---------------------------------------------------------------------- airflow/contrib/task_runner/cgroup_task_runner.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/0b477900/airflow/contrib/task_runner/cgroup_task_runner.py ---------------------------------------------------------------------- diff --git a/airflow/contrib/task_runner/cgroup_task_runner.py b/airflow/contrib/task_runner/cgroup_task_runner.py index 79aafc8..6a9e6cf 100644 --- a/airflow/contrib/task_runner/cgroup_task_runner.py +++ b/airflow/contrib/task_runner/cgroup_task_runner.py @@ -75,14 +75,12 @@ class CgroupTaskRunner(BaseTaskRunner): if path_element not in name_to_node: self.logger.debug("Creating cgroup {} in {}" .format(path_element, node.path)) - subprocess.check_output("sudo mkdir -p {}".format(path_element)) - subprocess.check_output("sudo chown -R {} {}".format( - self._cur_user, path_element)) + node = node.create_cgroup(path_element) else: self.logger.debug("Not creating cgroup {} in {} " "since it already exists" .format(path_element, node.path)) - node = name_to_node[path_element] + node = name_to_node[path_element] return node def _delete_cgroup(self, path):
