You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by js...@apache.org on 2024/06/26 18:13:32 UTC

(airflow) branch main updated: Move import to make PythonOperator working on Windows (#40424)

This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 923992d300 Move import to make PythonOperator working on Windows (#40424)
923992d300 is described below

commit 923992d30093b98363262587328387de1b0f7957
Author: Jens Scheffler <95...@users.noreply.github.com>
AuthorDate: Wed Jun 26 20:13:25 2024 +0200

    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 2faeea2100..17695fb0f0 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 @@ class PythonVirtualenvOperator(_BasePythonVirtualenvOperator):
         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"