From 362037359f8d9e7c9de2c5267fe5257b476d1caf Mon Sep 17 00:00:00 2001 From: Jens Scheffler <95105677+jscheffl@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:13:25 +0200 Subject: [PATCH] Move import to make PythonOperator working on Windows (#40424) --- airflow/operators/python.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airflow/operators/python.py b/airflow/operators/python.py index 2faeea2100a48..17695fb0f0aff 100644 --- a/airflow/operators/python.py +++ b/airflow/operators/python.py @@ -17,7 +17,6 @@ # under the License. from __future__ import annotations -import fcntl import importlib import inspect import json @@ -790,6 +789,8 @@ def _ensure_venv_cache_exists(self, venv_cache_path: Path) -> Path: venv_path.parent.mkdir(parents=True, exist_ok=True) with open(f"{venv_path}.lock", "w") as f: # Ensure that cache is not build by parallel workers + import fcntl + fcntl.flock(f, fcntl.LOCK_EX) hash_marker = venv_path / "install_complete_marker.json"