Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against None components of universal pathlib xcom backend #41921

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
potiuk marked this conversation as resolved.
Show resolved Hide resolved

@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",
potiuk marked this conversation as resolved.
Show resolved Hide resolved
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
4 changes: 1 addition & 3 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down