-
Notifications
You must be signed in to change notification settings - Fork 61
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
CopyIn fix #269
base: master
Are you sure you want to change the base?
CopyIn fix #269
Conversation
📝 WalkthroughWalkthroughThe changes to the Changes
Sequence DiagramsequenceDiagram
participant Caller
participant Ec2SSH
participant RemoteVM
Caller->>Ec2SSH: copyIn(vm, inputFiles)
Ec2SSH->>Ec2SSH: Validate input files
alt Invalid input
Ec2SSH-->>Caller: Return -1 (Error)
end
Ec2SSH->>RemoteVM: Prepare directory
alt Directory preparation fails
Ec2SSH-->>Caller: Return error code
end
loop File Transfer (max 3 attempts)
Ec2SSH->>RemoteVM: Copy file
alt File transfer successful
Ec2SSH->>Ec2SSH: Log success
else File transfer failed
Ec2SSH->>Ec2SSH: Retry copy
end
end
Ec2SSH-->>Caller: Return transfer result
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
vmms/ec2SSH.py (4)
349-349
: Remove trailing whitespace.Lines contain trailing whitespace that should be removed as flagged by the pipeline.
- +Also applies to: 353-353
🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
354-358
: Enhance error logging for invalid files.While the validation is good, the error message could be more specific to help identify which file is missing the required attributes.
- self.log.error("Invalid inputFiles structure") + invalid_files = [i for i, file in enumerate(inputFiles) + if not hasattr(file, 'localFile') or not hasattr(file, 'destFile')] + self.log.error(f"Invalid inputFiles structure: Files at indices {invalid_files} " + "are missing required attributes (localFile, destFile)")🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
359-359
: Move max_retries to configuration.The max_retries value should be defined in the configuration file for better maintainability and consistency.
- max_retries = 3 + max_retries = config.Config.COPYIN_MAX_RETRIES # Add this constant to config.py🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
378-381
: Enhance success logging message.The success message could include the number of files transferred for better observability.
- self.log.info(f"Successfully copied files to {domain_name}:autolab") + self.log.info(f"Successfully copied {len(inputFiles)} files to {domain_name}:autolab")🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
vmms/ec2SSH.py
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Python application
vmms/ec2SSH.py
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
🔇 Additional comments (2)
vmms/ec2SSH.py (2)
350-352
: LGTM! Good addition of directory preparation validation.The added validation ensures that the directory is properly prepared before proceeding with file transfers.
🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
363-376
: LGTM! Well-implemented retry mechanism.The retry logic with appropriate warning messages is a good addition that will improve reliability of file transfers.
🧰 Tools
🪛 GitHub Actions: Python application
[warning] File contains trailing whitespace that needed to be trimmed
[warning] Code formatting issues detected and automatically reformatted by Black
This fix attempts to address the inconsistency brought by the copyIn function.
Namely, this PR includes these notable changes: