From 2293e04a88938d4c0cbdabf03a808ff471b8d4cd Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 24 Jun 2023 09:57:51 +0200 Subject: [PATCH] Exit asset compilation fork in start-airflow after it completed The `start-airflow` command uses fork to start parallell asset compilation in the background so that it can happen while docker compose initializes. Unfortunately this fork child did not have sys.exit() so it returned from the function and continued to run second docker-compose in the background. In case asset compilation was not needed this could happen in parallel and both processes attempted to start two docker-compose commands in parallel. This was not visible in "dev" mode - because asset compilation never completed there also - when asset compilation was needed, it took some time before it completed, and the effect of it were not visible, because the forked process did not get terminal output (it has been taken over by tmux by the time it started to use it) and could not grab forwarded ports, so it was running but largely invisible. However when asset compilation was not needed, the two processes started to do the same things at the same time - so a lot of the output has been duplicated and for example the line output has been broken because the same messages were overwriting over each other and canceling the effect of EOL printed to terminal. With this change, the forked process exits as soon as the asset compilation is completed and does not repeat the same steps that the parent process is doiing. --- dev/breeze/src/airflow_breeze/utils/run_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/breeze/src/airflow_breeze/utils/run_utils.py b/dev/breeze/src/airflow_breeze/utils/run_utils.py index 5a46b5db6e03b..1456a03acc7f7 100644 --- a/dev/breeze/src/airflow_breeze/utils/run_utils.py +++ b/dev/breeze/src/airflow_breeze/utils/run_utils.py @@ -481,5 +481,6 @@ def run_compile_www_assets( # and create a new process group where we are the leader os.setpgid(0, 0) _run_compile_internally(command_to_execute, dev) + sys.exit(0) else: return _run_compile_internally(command_to_execute, dev)