You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by pi...@apache.org on 2022/06/02 02:41:59 UTC

[airflow] 01/01: Unify return_code interface for task runner

This is an automated email from the ASF dual-hosted git repository.

pingzh pushed a commit to branch pz-fix-return-code-interface
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 0cc3c29ced26096f5d685ed5daeeaaae8991f1ef
Author: Ping Zhang <pi...@umich.edu>
AuthorDate: Wed Jun 1 19:41:42 2022 -0700

    Unify return_code interface for task runner
---
 airflow/task/task_runner/base_task_runner.py   | 2 +-
 airflow/task/task_runner/cgroup_task_runner.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/task/task_runner/base_task_runner.py b/airflow/task/task_runner/base_task_runner.py
index 55dcf05d34..2a8634d8d0 100644
--- a/airflow/task/task_runner/base_task_runner.py
+++ b/airflow/task/task_runner/base_task_runner.py
@@ -160,7 +160,7 @@ class BaseTaskRunner(LoggingMixin):
         """Start running the task instance in a subprocess."""
         raise NotImplementedError()
 
-    def return_code(self) -> Optional[int]:
+    def return_code(self, timeout: int = 0) -> Optional[int]:
         """
         :return: The return code associated with running the task instance or
             None if the task is not yet done.
diff --git a/airflow/task/task_runner/cgroup_task_runner.py b/airflow/task/task_runner/cgroup_task_runner.py
index d6c6e53abf..7b0aae3e18 100644
--- a/airflow/task/task_runner/cgroup_task_runner.py
+++ b/airflow/task/task_runner/cgroup_task_runner.py
@@ -163,7 +163,7 @@ class CgroupTaskRunner(BaseTaskRunner):
         self.log.debug("Starting task process with cgroups cpu,memory: %s", cgroup_name)
         self.process = self.run_command(['cgexec', '-g', f'cpu,memory:{cgroup_name}'])
 
-    def return_code(self):
+    def return_code(self, timeout: int = 0) -> Optional[int]:
         return_code = self.process.poll()
         # TODO(plypaul) Monitoring the control file in the cgroup fs is better than
         # checking the return code here. The PR to use this is here: