From bb9a9a2df8a0bbc012410247e9360b9a2e14b727 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sun, 1 Sep 2024 04:17:13 +0200 Subject: [PATCH] Protect against None components of universal pathlib xcom backend fixes: #41723 --- airflow/io/path.py | 2 +- airflow/providers/common/io/xcom/backend.py | 7 ++++++- hatch_build.py | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/airflow/io/path.py b/airflow/io/path.py index c6d9255f91d44..6deafae004959 100644 --- a/airflow/io/path.py +++ b/airflow/io/path.py @@ -198,7 +198,7 @@ def replace(self, target) -> ObjectStoragePath: Returns the new Path instance pointing to the target path. """ - return self.rename(target, overwrite=True) + return self.rename(target) @classmethod def cwd(cls): diff --git a/airflow/providers/common/io/xcom/backend.py b/airflow/providers/common/io/xcom/backend.py index de64522fb20c3..af55baa4c0628 100644 --- a/airflow/providers/common/io/xcom/backend.py +++ b/airflow/providers/common/io/xcom/backend.py @@ -142,7 +142,12 @@ def serialize_value( base_path = _get_base_path() while True: # Safeguard against collisions. - p = base_path.joinpath(dag_id, run_id, task_id, f"{uuid.uuid4()}{suffix}") + p = base_path.joinpath( + dag_id or "NO_DAG_ID", + run_id or "NO_RUN_ID", + task_id or "NO_TASK_ID", + f"{uuid.uuid4()}{suffix}", + ) if not p.exists(): break p.parent.mkdir(parents=True, exist_ok=True) diff --git a/hatch_build.py b/hatch_build.py index 08f47731f2c47..4e17e1a8ec7ad 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -494,9 +494,7 @@ # See https://github.com/apache/airflow/pull/31693 # We should also remove "3rd-party-licenses/LICENSE-unicodecsv.txt" file when we remove this dependency "unicodecsv>=0.14.1", - # The Universal Pathlib provides Pathlib-like interface for FSSPEC - # https://github.com/apache/airflow/issues/41723 describes the issue - "universal-pathlib==0.2.2", # Temporarily pin to 0.2.2 as 0.2.3 generates mypy errors + "universal-pathlib>=0.2.3", # Werkzug 3 breaks Flask-Login 0.6.2, also connexion needs to be updated to >= 3.0 # we should remove this limitation when FAB supports Flask 2.3 and we migrate connexion to 3+ "werkzeug>=2.0,<3",