Skip to content

Commit

Permalink
Protect against None components of universal pathlib xcom backend (ap…
Browse files Browse the repository at this point in the history
…ache#41921)

fixes: apache#41723
(cherry picked from commit 7a75f0a)
  • Loading branch information
potiuk committed Sep 1, 2024
1 parent 3b9935e commit 0a9749c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion airflow/io/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 6 additions & 1 deletion airflow/providers/common/io/xcom/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,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
"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",
Expand Down

0 comments on commit 0a9749c

Please sign in to comment.