Skip to content

Commit

Permalink
Output of the "dev" asset compilation for breeze available in file (#…
Browse files Browse the repository at this point in the history
…28579)

When you start airflow in `dev-mode`, the output of asset compilation
(which run continuously) is now available in a file that you can
run `tail -f` on to see the output.

(cherry picked from commit 790b9d1)
  • Loading branch information
potiuk authored and ephraimbuddy committed Jan 12, 2023
1 parent c8a91a5 commit f9e535b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/ci/pre_commit/pre_commit_compile_www_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
sys.exit(0)
env = os.environ.copy()
env["FORCE_COLOR"] = "true"
subprocess.check_call(["yarn", "install", "--frozen-lockfile"], cwd=str(www_directory))
subprocess.check_call(["yarn", "run", "build"], cwd=str(www_directory), env=env)
subprocess.check_call(["yarn", "install", "--frozen-lockfile"], cwd=os.fspath(www_directory))
subprocess.check_call(["yarn", "run", "build"], cwd=os.fspath(www_directory), env=env)
WWW_HASH_FILE.write_text(new_hash)
24 changes: 20 additions & 4 deletions scripts/ci/pre_commit/pre_commit_compile_www_assets_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,30 @@
)

AIRFLOW_SOURCES_PATH = Path(__file__).parents[3].resolve()
WWW_HASH_FILE = AIRFLOW_SOURCES_PATH / ".build" / "www" / "hash.txt"
WWW_CACHE_DIR = AIRFLOW_SOURCES_PATH / ".build" / "www"
WWW_HASH_FILE = WWW_CACHE_DIR / "hash.txt"
WWW_ASSET_OUT_FILE = WWW_CACHE_DIR / "asset_compile.out"

if __name__ == "__main__":
www_directory = Path("airflow") / "www"
www_directory = AIRFLOW_SOURCES_PATH / "airflow" / "www"
if WWW_HASH_FILE.exists():
# cleanup hash of www so that next compile-assets recompiles them
WWW_HASH_FILE.unlink()
env = os.environ.copy()
env["FORCE_COLOR"] = "true"
subprocess.check_call(["yarn", "install", "--frozen-lockfile"], cwd=str(www_directory))
subprocess.check_call(["yarn", "dev"], cwd=str(www_directory), env=env)
with open(WWW_ASSET_OUT_FILE, "w") as f:
subprocess.run(
["yarn", "install", "--frozen-lockfile"],
cwd=os.fspath(www_directory),
check=True,
stdout=f,
stderr=subprocess.STDOUT,
)
subprocess.run(
["yarn", "dev"],
check=True,
cwd=os.fspath(www_directory),
env=env,
stdout=f,
stderr=subprocess.STDOUT,
)

0 comments on commit f9e535b

Please sign in to comment.