Buckets:

redmingwei's picture
download
raw
1.43 kB
"""轮询后台任务的日志与状态。"""
import os
import sys
from pathlib import Path
LOGS = Path("/domains/runs/logs")
def main():
script = sys.argv[1] if len(sys.argv) > 1 else "build_4d_eeg_train.py"
tail = int(sys.argv[2]) if len(sys.argv) > 2 else 40
log = LOGS / f"{script}.log"
pid_f = LOGS / f"{script}.pid"
if not log.exists():
print(f"无日志: {log}")
return
pid = None
if pid_f.exists():
try:
pid = int(pid_f.read_text().strip())
except Exception:
pass
# 进程是否还活着
alive = False
if pid:
try:
os.kill(pid, 0)
alive = True
except OSError:
alive = False
txt = log.read_text(errors="replace")
lines = txt.splitlines()
print(f"PID={pid} alive={alive} | 日志 {len(lines)} 行 | "
f"大小 {log.stat().st_size} bytes")
print("-" * 70)
for ln in lines[-tail:]:
print(ln)
print("-" * 70)
# 输出目录当前体量
out = Path("/domains/omnibrain4d/eeg_train")
if out.exists():
files = sorted(out.glob("*.npz"))
tot = sum(f.stat().st_size for f in files) / 1024 ** 3
print(f"已产出 {len(files)} 个 npz,合计 {tot:.2f} GB")
for f in files[-4:]:
print(f" {f.name}: {f.stat().st_size/1024**3:.2f} GB")
if __name__ == "__main__":
main()

Xet Storage Details

Size:
1.43 kB
·
Xet hash:
fa71c5682b49b37cabb5ae2fd29e09789b22156368e0aba2f8aecc48474f17d7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.