Skip to content

Add upload_file and download_file support#161

Merged
cijohnson merged 2 commits into
mainfrom
ichristo/support-multiprocess-file-transfer
May 14, 2026
Merged

Add upload_file and download_file support#161
cijohnson merged 2 commits into
mainfrom
ichristo/support-multiprocess-file-transfer

Conversation

@cijohnson
Copy link
Copy Markdown
Contributor

to MultiProcessPssh with operation registry

This commit addresses API incompatibility issues between Pssh and MultiProcessPssh classes and implements a robust operation registry system to prevent future drift.

Key Changes:

  • Add missing upload_file and download_file methods to MultiProcessPssh class
  • Implement operation registry (SUPPORTED_OPERATIONS) as single source of truth
  • Use method names directly as operation names to eliminate mapping errors
  • Add missing detailed parameter support to MultiProcessPssh.exec()

API Parity Testing:

  • Add comprehensive test suite to catch missing methods automatically
  • Validate method signatures match between Pssh and MultiProcessPssh
  • Verify operation registry completeness and consistency
  • Test runtime execution of all sharder operations with proper parameters

Operations Updated:

  • exec -> exec (added detailed parameter support)
  • upload_file -> upload_file (new operation, matches method name)
  • download_file -> download_file (new operation, matches method name)

This ensures MultiProcessPssh maintains full API compatibility with Pssh and prevents the class of issues that led to missing upload_file/download_file methods.

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

Comment thread cvs/lib/parallel/unittests/test_multiprocess_pssh.py Outdated
Comment thread cvs/lib/parallel/unittests/test_multiprocess_pssh.py Outdated
Comment thread cvs/lib/parallel/unittests/test_pssh_sharder.py Outdated
Comment thread cvs/lib/parallel/pssh_sharder.py Outdated
Comment thread cvs/lib/parallel/multiprocess_pssh.py Outdated
Comment thread cvs/lib/parallel/pssh_sharder.py Outdated
@cijohnson cijohnson force-pushed the ichristo/support-multiprocess-file-transfer branch 4 times, most recently from d7471d2 to e2b2ffc Compare May 12, 2026 21:50
@cijohnson
Copy link
Copy Markdown
Contributor Author

@speriaswamy-amd addressed all the review comments, introduced ABC and class composition instead of inheritance to ensure all shardable methods of Pssh are implemented in MultiprocessPssh, also dynamically handling shardable methods in run_shard. Removed unnecessary UT's to cover old behaviour

Comment thread cvs/lib/parallel/multiprocess_pssh.py Outdated
Comment thread cvs/lib/parallel/multiprocess_pssh.py
cijohnson and others added 2 commits May 14, 2026 14:04
to MultiProcessPssh with operation registry

This commit addresses API incompatibility issues between Pssh and MultiProcessPssh
classes and implements a robust operation registry system to prevent future drift.

Key Changes:
- Add missing upload_file and download_file methods to MultiProcessPssh class
- Implement operation registry (SUPPORTED_OPERATIONS) as single source of truth
- Use method names directly as operation names to eliminate mapping errors
- Add missing detailed parameter support to MultiProcessPssh.exec()

API Parity Testing:
- Add comprehensive test suite to catch missing methods automatically
- Validate method signatures match between Pssh and MultiProcessPssh
- Verify operation registry completeness and consistency
- Test runtime execution of all sharder operations with proper parameters

Operations Updated:
- exec -> exec (added detailed parameter support)
- upload_file -> upload_file (new operation, matches method name)
- download_file -> download_file (new operation, matches method name)

This ensures MultiProcessPssh maintains full API compatibility with Pssh
and prevents the class of issues that led to missing upload_file/download_file methods.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Ignatious Johnson <ichristo@amd.com>
This commit addresses all PR review comments by completely refactoring
the multiprocess SSH architecture to be cleaner, more maintainable, and
more robust.

Key Architectural Changes:
- Replace inheritance with ABC + composition pattern
- Eliminate registry + if/elif tree with dynamic method dispatch
- Create single source of truth via ShardableSshInterface ABC
- Move ABC to separate interfaces.py to avoid circular imports

Review Comments Addressed:
- #1-#2: Fixed operation name mismatches (upload/download)
- #3: Updated test expectations for new calling convention
- #4: Proper error handling with early ABC validation
- #5: Maintained custom download_file result merging
- #6: Implemented exact dynamic approach suggested by reviewer

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Ignatious Johnson <ichristo@amd.com>
@cijohnson cijohnson force-pushed the ichristo/support-multiprocess-file-transfer branch from e2b2ffc to 7b58cb1 Compare May 14, 2026 21:10
Copy link
Copy Markdown
Contributor

@speriaswamy-amd speriaswamy-amd left a comment

Choose a reason for hiding this comment

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

LGTM

@cijohnson cijohnson merged commit d666287 into main May 14, 2026
2 checks passed
@cijohnson cijohnson deleted the ichristo/support-multiprocess-file-transfer branch May 14, 2026 21:28
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.

2 participants