Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant new feature: the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new file saving API, swanlab.save(), which provides a comprehensive mechanism for uploading files associated with an experiment. The implementation is well-structured, featuring support for different saving policies ('now', 'end', 'live'), multipart uploads for large files, and background processing using threads for both uploads and file watching. The code is logically organized into new modules like file_service and save_manager. Overall, this is a solid feature addition. I have identified one high-severity issue concerning memory usage during single-part file uploads, which should be addressed.
This reverts commit 05c35b2.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new swanlab.save() API, enabling users to upload files to the SwanLab backend with support for immediate, end-of-run, or live-monitoring policies. The implementation features a FileUploadManager for handling single and multipart uploads, a DirWatcher for tracking file modifications, and new API endpoints for managing the upload lifecycle. Review feedback suggests enhancing error handling in multipart uploads to ensure consistent state reporting, adding type hints to utility functions, simplifying redundant attribute checks on response objects, and improving logging for failed upload attempts.
| [file.complete_request(state=SaveFileState.FAILED)], | ||
| ) | ||
|
|
||
| def _upload_multipart(self, file: SaveFileModel, size: int, exp_id: str) -> None: |
There was a problem hiding this comment.
For better error handling and consistency with _upload_single, consider wrapping the logic of _upload_multipart in a try...except block. Currently, if any part of the multipart upload fails, the exception is caught higher up, but the file is not explicitly marked as FAILED on the backend, unlike in _upload_single. This could lead to an inconsistent state for the file.
Description
swanlab.save()api for file upload