Spaces:
Sleeping
Sleeping
Download backend/scripts/prune_radio_cache.py from stylevoice/talk: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/scripts/prune_radio_cache.py
- Command line
-
hf download hf://spaces/stylevoice/talk/backend/scripts/prune_radio_cache.py
-
curl -L -o prune_radio_cache.py https://huggingface.co/spaces/stylevoice/talk/resolve/main/backend/scripts/prune_radio_cache.py
1.57 kB
| """radio/realtime ์บ์ ๋์ ์ ๋ฆฌ CLI โ dry-run ์ฐ์ , ์ญ์ ๋ --apply. | |
| ํต์ฌ ๋ก์ง์ services/radio_cache_prune.py ๊ณต์ฉ(์ผ์ผ ํฌ๋ก ๊ณผ ๋์ผ). ์ด CLI๋ ์๋ ์คํ/๊ฒ์ฆ์ฉ. | |
| โ ๏ธ ์์ฑ ์๋์ญ์ ์ฌ๊ณ ์ด๋ ฅ ์ค์ โ ๋ฐ๋์ dry-run ํ์ธ ํ --apply. | |
| ์คํ(Oracle ์ปจํ ์ด๋ ๋ด): | |
| python scripts/prune_radio_cache.py # dry-run(์ง๊ณ) | |
| python scripts/prune_radio_cache.py --apply # ์ค์ ์ญ์ | |
| python scripts/prune_radio_cache.py --ments-days 14 --realtime-days 3 | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import asyncio | |
| import sys | |
| sys.path.insert(0, "/app/backend") | |
| async def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--ments-days", type=int, default=7) | |
| ap.add_argument("--realtime-days", type=int, default=2) | |
| ap.add_argument("--apply", action="store_true", help="์ค์ ์ญ์ (๊ธฐ๋ณธ dry-run)") | |
| args = ap.parse_args() | |
| from services import radio_cache_prune as rcp | |
| stats = await rcp.prune( | |
| ments_days=args.ments_days, realtime_days=args.realtime_days, apply=args.apply) | |
| mb = stats["bytes"] / 1024 / 1024 | |
| print(f"์ญ์ ํ๋ณด: {stats['candidates']}๊ฐ / {mb:.1f} MB " | |
| f"(radio/ments >{args.ments_days}์ผ + realtime >{args.realtime_days}์ผ, studio ์ ์ธ)") | |
| if args.apply: | |
| print(f"[apply] ์ญ์ {stats['deleted']} ยท ์คํจ {stats['failed']}") | |
| else: | |
| print("[dry-run] ์ญ์ ์ ํจ. ์ค์ ์ญ์ = --apply") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |