You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/07 10:05:47 UTC
[GitHub] [airflow] kaxil commented on a change in pull request #11327: Reduce "start-up" time for tasks in LocalExecutor
kaxil commented on a change in pull request #11327:
URL: https://github.com/apache/airflow/pull/11327#discussion_r500892060
##########
File path: airflow/executors/local_executor.py
##########
@@ -65,14 +74,31 @@ def execute_work(self, key: TaskInstanceKey, command: CommandType) -> None:
if key is None:
return
self.log.info("%s running %s", self.__class__.__name__, command)
+ old_title = getproctitle()
try:
- subprocess.check_call(command, close_fds=True)
+ from airflow.cli.cli_parser import get_parser
+ parser = get_parser()
+ # [1:] - remove "airflow" from the start of the command
+ args = parser.parse_args(command[1:])
+
+ setproctitle(f"airflow task supervisor: {command}")
+
+ args.func(args)
state = State.SUCCESS
- except subprocess.CalledProcessError as e:
+ except BaseException as e:
state = State.FAILED
self.log.error("Failed to execute task %s.", str(e))
+ finally:
+ setproctitle(old_title)
self.result_queue.put((key, state))
+ @abstractmethod
+ def do_work(self):
+ """
+ Called in the subprocess and should get then execute tasks
Review comment:
```suggestion
Called in the subprocess and should then execute tasks
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org