Skip to content

S3 copy utils - #73

Open
sharmishtaa wants to merge 5 commits into
mainfrom
s3_copy_utils
Open

S3 copy utils#73
sharmishtaa wants to merge 5 commits into
mainfrom
s3_copy_utils

Conversation

@sharmishtaa

Copy link
Copy Markdown
Collaborator

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
Copying files to the benchmark dataset

What does this PR do?
Adds some utils for copying data and some example scripts that use it.

References

Please reference any existing issues/PRs that relate to this PR.

How has this PR been tested?

Please explain how any new code has been tested, and how you have ensured that no existing functionality has changed.

Is this a breaking change?

No

Does this PR require an update to the documentation?

If any features have changed, or have been added. Please explain how the
documentation has been updated.

Checklist:

  • [X ] The code has been tested locally
  • [X ] Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@sharmishtaa
sharmishtaa requested a review from niksirbi July 30, 2026 00:57
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.24%. Comparing base (732b125) to head (3cc9c0b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
+ Coverage   93.99%   98.24%   +4.25%     
==========================================
  Files           5        5              
  Lines         416      514      +98     
==========================================
+ Hits          391      505     +114     
+ Misses         25        9      -16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

sharmishtaa and others added 5 commits August 5, 2026 11:50
Add utilities to s3.py for copying S3 folders with file filtering:
- list_s3_objects: List objects with pagination support
- copy_s3_object: Copy single S3 objects
- delete_s3_objects: Batch delete with 1000-object limit handling
- copy_s3_folder: Copy folders with tracking and automatic rollback on failure
- create_filename_exclude_filter: Create filters supporting glob patterns, path patterns, and regex

Add example scripts:
- copy_s3_folder.py: Copy S3 folders with exclusion patterns
- extract_startlabels_s3.py: Extract startlabels from single cliplabels file
- extract_startlabels_s3_list.py: Batch process multiple cliplabels files

Add comprehensive test coverage (18 new tests, 77% coverage for s3.py).
All code passes linting with 88-character line limit.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive documentation improvements:
- Module-level note about boto3 client creation behavior
- Document 5GB file size limit for copy_s3_object
- Clarify that copy_s3_folder success return value is always True

Add validation for partial delete failures:
- Check delete_objects response for errors
- Raise RuntimeError with detailed error messages on partial failure
- Add test for partial deletion failure scenario

This ensures rollback operations properly detect and report failures
when some objects cannot be deleted.

Coverage improved from 77% to 79% (22 tests passing).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Resolve E501 (line too long) and F841 (unused variable) errors:
- Break long lines in docstrings, comments, and code examples
- Remove unused mock_copy variables in test functions
- Reformat inline comments to comply with 79 character limit

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Achieve 100% test coverage for poseinterface/s3.py by adding tests for:
- download_json_from_s3: success, NoSuchKey error, and other ClientErrors
- upload_json_to_s3: successful upload
- list_s3_objects: ClientError handling
- copy_s3_object: ClientError handling
- delete_s3_objects: ClientError handling
- copy_s3_folder: rollback failure scenario

All exception paths in except blocks are now covered.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

1 participant