Skip to content
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

feat: increase log len #750

Merged
merged 4 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/硬件信息采集.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ class MonitorCron:

1. 如果没什么好采集的,返回空列表
2.

如果有需要采集的,列表内的函数签名应该一致——此函数不接受任何参数,返回一个字典,字典类型为[HardwareInfo](/swanlab/data/run/metadata/hardware/type.py)

> HardwareInfo字典类型遵循swanlab创建column的协议,包含列名称、图表配置、组配置等信息
### CPU信息采集

TODO
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ urllib3>=1.26.0
requests>=2.25.0
click
pyyaml
psutil
psutil>=5.0.0
gputil==1.4.0
pynvml
rich
2 changes: 1 addition & 1 deletion swanlab/data/run/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _(state: SwanLabRunState):
swanlog.debug("Monitor on.")
self.monitor_cron = MonitorCron(self.__get_monitor_func())
else:
swanlog.debug("Monitor off because of no monitor funcs.")
swanlog.debug("Monitor off because of no monitor func.")
else:
swanlog.debug("Monitor off.")

Expand Down
9 changes: 4 additions & 5 deletions swanlab/log/console.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import sys
import os
import sys
from datetime import datetime
from swankit.log import FONT
from swankit.env import create_time
import re

from swankit.env import create_time
from swankit.log import FONT

MAX_UPLOAD_LEN = 200
MAX_UPLOAD_LEN = 500


class SwanWriterProxy:
Expand Down
11 changes: 6 additions & 5 deletions test/unit/log/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
测试swanlog类,只需测试其日志监听功能
"""
import os
import sys

import pytest
from freezegun import freeze_time
from nanoid import generate

from swanlab.log import swanlog
from tutils import TEMP_PATH
from nanoid import generate
from freezegun import freeze_time


@pytest.fixture(scope="function", autouse=True)
Expand Down Expand Up @@ -87,12 +88,12 @@ def test_write_to_file_long_test(self):
swanlog.install(console_dir)
# 加一行防止其他问题
print("\ntest write to file")
a = generate(size=201)
a = generate(size=501)
print(a)
files = os.listdir(console_dir)
with open(os.path.join(console_dir, files[0]), "r") as f:
content = f.readlines()
assert content[-1] == a[:200] + "\n"
assert content[-1] == a[:500] + "\n"

def test_write_logging_to_file(self):
console_dir = self.create_console_dir()
Expand Down
Loading