| 1234567891011121314151617181920212223242526272829303132 |
- """Import algorithm stage labels into compressor_label (CLI wrapper)."""
- from __future__ import annotations
- import argparse
- from app.services.label_import_service import build_rows, load_site_points, run_import
- def main() -> None:
- parser = argparse.ArgumentParser(description="导入算法阶段标签到 compressor_label")
- parser.add_argument("--dry-run", action="store_true", help="只统计,不写库")
- args = parser.parse_args()
- if args.dry_run:
- site_points = load_site_points()
- rows = build_rows(site_points)
- counts: dict[str, int] = {}
- for row in rows:
- counts[row[0]] = counts.get(row[0], 0) + 1
- print(f"待导入 {len(rows)} 条:{counts}")
- return
- result = run_import()
- print(f"导入 {result['total']} 条:{result['bySource']}")
- if result["skippedFiles"]:
- print("跳过文件:", result["skippedFiles"])
- print("库内有效算法标签:", result["activeLabels"])
- if __name__ == "__main__":
- main()
|