feat(ai): add PixelRAG marketplace identity matcher replay
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
77
scripts/ops/run_pixelrag_marketplace_identity_matcher_replay.py
Executable file
77
scripts/ops/run_pixelrag_marketplace_identity_matcher_replay.py
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run or dry-run PixelRAG marketplace identity matcher replay."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from services.pixelrag_marketplace_identity_matcher_replay_service import ( # noqa: E402
|
||||
run_pixelrag_marketplace_identity_matcher_replay,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="執行或 dry-run PixelRAG marketplace identity matcher replay。"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--adapter-dry-run-receipt-root",
|
||||
help="Marketplace adapter dry-run receipt root;預設使用 production/container 設定。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output-root",
|
||||
help="Marketplace identity matcher replay artifact receipt output root。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--platform",
|
||||
action="append",
|
||||
dest="platforms",
|
||||
help="限制平台,可重複指定,例如 --platform shopee_tw --platform coupang_tw。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--max-age-hours",
|
||||
type=int,
|
||||
default=168,
|
||||
help="receipt 最大新鮮度小時數。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--limit",
|
||||
type=int,
|
||||
default=25,
|
||||
help="最多處理 adapter dry-run receipt 數。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--execute",
|
||||
action="store_true",
|
||||
help="執行 identity matcher replay;未指定時只做 no-write dry-run readiness。",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--write-receipt",
|
||||
action="store_true",
|
||||
help="execute 後寫入 identity matcher replay artifact receipt;不寫 DB。",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
payload = run_pixelrag_marketplace_identity_matcher_replay(
|
||||
adapter_dry_run_receipt_root=args.adapter_dry_run_receipt_root,
|
||||
output_root=args.output_root,
|
||||
platform=tuple(args.platforms or ()),
|
||||
max_age_hours=args.max_age_hours,
|
||||
limit=args.limit,
|
||||
execute=args.execute,
|
||||
write_receipt=bool(args.write_receipt and args.execute),
|
||||
)
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0 if payload.get("success") else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user