-
Notifications
You must be signed in to change notification settings - Fork 141
Feature/backup #1018
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
Feature/backup #1018
Conversation
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.
Pull Request Overview
Adds a basic framework and integration points for a new “backup” mode that writes and retains local logs without uploading to the cloud.
- Introduce a
backup
flag in settings and extendmode
/init
logic to handlebackup
. - Refactor the core logger to dispatch to multiple handlers and inject a backup handler.
- Add stub modules and callbacks under
swanlab/log/backup
andswanlab/data/callbacker/backup
.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
test/unit/data/callbacker/test_local.py | Updated test to call _terminal_handler instead of _write_handler . |
swanlab/swanlab_settings.py | Added backup: StrictBool field to settings. |
swanlab/log/log.py | Refactored to support multiple handlers and no longer take a per-handler arg. |
swanlab/log/backup/models.py | Added stub module for backup JSON models. |
swanlab/log/backup/init.py | Implemented BackupHandler with decorator stubs. |
swanlab/env.py | Extended MODE enum and removed one RUNTIME value. |
swanlab/data/utils.py | Adjusted _create_operator signature to accept login_info and cbs . |
swanlab/data/sdk.py | Updated SDK init to support backup mode and logdir setup. |
swanlab/data/run/main.py | Updated run initialization to control save behavior and expanded on_init flow. |
swanlab/data/run/callback.py | Added low-level terminal/error hooks and backup integration. |
swanlab/data/callbacker/local.py | Cleaned up old write handler, introduced _terminal_handler . |
swanlab/data/callbacker/cloud.py | Removed duplicate utils and aligned terminal handling. |
swanlab/data/callbacker/backup.py | Added stub callback for backup mode. |
swanlab/api/http.py | Exposed history_exp_count and removed return from mount_project . |
Comments suppressed due to low confidence (2)
test/unit/data/callbacker/test_local.py:33
- [nitpick] The test is still named
test_local_write_handler
but now calls_terminal_handler
. Rename the test totest_local_terminal_handler
(and update any references) for clarity.
def test_local_write_handler(monkeypatch):
swanlab/data/run/main.py:227
- The code uses
random.randint
butrandom
is not imported in this module, leading to aNameError
. Addimport random
at the top.
num = random.randint(0, 20)
完成日志备份基本框架