airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] mik-laj commented on a change in pull request #6905: [AIRFLOW-6361] Run LocalTaskJob directly in Celery task
Date Fri, 27 Dec 2019 16:06:27 GMT
mik-laj commented on a change in pull request #6905: [AIRFLOW-6361] Run LocalTaskJob directly
in Celery task
URL: https://github.com/apache/airflow/pull/6905#discussion_r361695192
 
 

 ##########
 File path: airflow/executors/celery_executor.py
 ##########
 @@ -59,17 +58,17 @@
 
 
 @app.task
-def execute_command(command_to_exec: str) -> None:
+def execute_command(command_to_exec: List[str]) -> None:
     """Executes command."""
     log = LoggingMixin().log
     log.info("Executing command in Celery: %s", command_to_exec)
-    env = os.environ.copy()
     try:
-        subprocess.check_call(command_to_exec, stderr=subprocess.STDOUT,
-                              close_fds=True, env=env)
-    except subprocess.CalledProcessError as e:
-        log.exception('execute_command encountered a CalledProcessError')
-        log.error(e.output)
+        parser = CLIFactory.get_parser()
+        # drop "airflow"
+        command_to_exec = command_to_exec[1:]
+        args = parser.parse_args(command_to_exec)
+        args.func(args)
 
 Review comment:
   I wanted to delete CLI references completely during another refactoring, but it makes sense
to create functions now.

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message