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

Fix Azure typing issues #191

Merged
merged 1 commit into from
Aug 19, 2024
Merged
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
11 changes: 10 additions & 1 deletion rohmu/object_storage/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,16 @@ def _copy_file_from_bucket(
if time.monotonic() - start < timeout:
time.sleep(0.1)
else:
destination_client.abort_copy(copy_props.id, timeout=timeout)
if copy_props.id is None:
# The description of CopyProperties tells us copy_id should not be None unless status is also None
# The type checker cannot know this, but we still log a warning if this ever happens
self.log.warning(
"Pending copy operation from %r to %r was missing a copy_id, will not be aborted after timeout",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "will not be aborted after timeout" -> "thus cannot be aborted"

source_key,
destination_key,
)
else:
destination_client.abort_copy(copy_props.id, timeout=timeout)
raise StorageError(
f"Copying {repr(source_key)} to {repr(destination_key)} did not complete in {timeout} seconds"
)
Expand Down
Loading