Skip to content

AP-724: Add resume support for interrupted file transfers#85

Merged
steve-sullivan merged 2 commits into
mainfrom
AP-724-resume
Jul 14, 2026
Merged

AP-724: Add resume support for interrupted file transfers#85
steve-sullivan merged 2 commits into
mainfrom
AP-724-resume

Conversation

@steve-sullivan

Copy link
Copy Markdown
Contributor

No description provided.

@davezuckerman

Copy link
Copy Markdown
Contributor

Before digging too deeply into the code it looks like a lot of this is a refactor and not related to the ticket unless I'm missing something. Should the refactor be a separate merge request or is it required for resume support?

@anarchivist anarchivist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r+; generally looks good to me. (tried to run it locally and ran out of disk space 😅)

@steve-sullivan

Copy link
Copy Markdown
Contributor Author

Before digging too deeply into the code it looks like a lot of this is a refactor and not related to the ticket unless I'm missing something. Should the refactor be a separate merge request or is it required for resume support?

The changes in copy_files.py is pretty much just refactoring. They could be a separate PR, but not really sure it's worth the effort at this point.
The main changes that are really specific to resuming an interrupted file transfer are in file_transfer.py (changes to copy_files_from_manifest and manifest_entry_matches_file. )

@awilfox awilfox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r+wc: A few style nits, but overall really well done!

Comment thread mokelumne/dags/copy_files.py
Comment thread mokelumne/util/file_transfer.py Outdated
Comment thread mokelumne/util/file_transfer.py Outdated
Comment thread mokelumne/util/file_transfer.py Outdated
Comment on lines +175 to +176


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need this many blank lines. (I'm surprised nothing complained?)

Suggested change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I noticed that one too right after I put in the PR...surprised as well whatever linter we're using didn't kick and scream about that one! (Fixed!)

Comment thread test/unit/test_file_transfer.py Outdated
Comment on lines +429 to +434
monkeypatch.setattr(
file_transfer.shutil,
"copy2",
real_copy2,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a "dead store": the value is never used before being set again at line 441.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Comment thread test/unit/test_file_transfer.py Outdated
if not destination_path.is_dir():
raise AirflowFailException(f"Destination is not a directory: {destination_path}")

if next(os.scandir(destination_path), None) is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor, since we're using pathlib quite a bit and destination_path is a Path might want to stick with that.

Suggested change
if next(os.scandir(destination_path), None) is not None:
if any(destination_path.iterdir())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had that previously but Anna pointed out that the performance would be an issue:
"iterdir() is correct, but os.scandir() is faster, especially on NFS."

I'd lean on performance over style here!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, I see that now. Looks like iterdir() reads everything in at once which can cause a bottleneck. Looks like next(destination_path.glob("*"), None) is not None: would os.scandir under the hood with the pathlib approach so probably the same performance.

pretty nitpicky though

@anarchivist anarchivist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

follow up r+ after chcanges.

@awilfox awilfox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r+ looks great!

@steve-sullivan
steve-sullivan merged commit e0d8662 into main Jul 14, 2026
5 checks passed
@steve-sullivan
steve-sullivan deleted the AP-724-resume branch July 14, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants