|
@@ -128,10 +128,16 @@ def discover_videos_from_demands(
|
|
|
执行前会预写 video_discovery_run,并按 biz_dt + demand_grade_id 跳过已执行记录。
|
|
执行前会预写 video_discovery_run,并按 biz_dt + demand_grade_id 跳过已执行记录。
|
|
|
默认处理全部 S/A(S 优先于 A、再按 score 排序);仅 CLI --top-limit 可人为截断。
|
|
默认处理全部 S/A(S 优先于 A、再按 score 排序);仅 CLI --top-limit 可人为截断。
|
|
|
当日 primary+backup 去重视频达到 200 时提前结束,否则跑完待处理队列。
|
|
当日 primary+backup 去重视频达到 200 时提前结束,否则跑完待处理队列。
|
|
|
|
|
+ 固定单线程串行执行 find_agent(workers 参数已废弃,始终为 1)。
|
|
|
"""
|
|
"""
|
|
|
started_at = datetime.now()
|
|
started_at = datetime.now()
|
|
|
batch_run_id = uuid.uuid4().hex
|
|
batch_run_id = uuid.uuid4().hex
|
|
|
- ensure_mysql_pool_capacity(max(1, int(workers)))
|
|
|
|
|
|
|
+ if int(workers) != 1:
|
|
|
|
|
+ logger.warning(
|
|
|
|
|
+ "discover_videos_from_demands ignores workers=%s; running single-threaded",
|
|
|
|
|
+ workers,
|
|
|
|
|
+ )
|
|
|
|
|
+ ensure_mysql_pool_capacity(1)
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
resolved_biz_dt, contexts = list_find_demand_contexts(
|
|
resolved_biz_dt, contexts = list_find_demand_contexts(
|
|
@@ -204,7 +210,7 @@ def discover_videos_from_demands(
|
|
|
logger.info("discover_videos_from_demands finished: %s", result)
|
|
logger.info("discover_videos_from_demands finished: %s", result)
|
|
|
return result
|
|
return result
|
|
|
|
|
|
|
|
- worker_count = max(1, min(int(workers), len(contexts)))
|
|
|
|
|
|
|
+ worker_count = 1
|
|
|
result["workers"] = worker_count
|
|
result["workers"] = worker_count
|
|
|
|
|
|
|
|
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
with ThreadPoolExecutor(max_workers=worker_count) as executor:
|
|
@@ -354,14 +360,11 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
_args = sys.argv[1:]
|
|
_args = sys.argv[1:]
|
|
|
_biz_dt = _args[0] if _args and not _args[0].startswith("-") else None
|
|
_biz_dt = _args[0] if _args and not _args[0].startswith("-") else None
|
|
|
- _workers_arg = None
|
|
|
|
|
- if _biz_dt and len(_args) > 1 and not _args[1].startswith("-"):
|
|
|
|
|
- _workers_arg = _args[1]
|
|
|
|
|
|
|
|
|
|
run_cli(
|
|
run_cli(
|
|
|
lambda: discover_videos_from_demands(
|
|
lambda: discover_videos_from_demands(
|
|
|
_biz_dt,
|
|
_biz_dt,
|
|
|
- workers=int(_workers_arg) if _workers_arg else 1,
|
|
|
|
|
|
|
+ workers=1,
|
|
|
offset=_read_flag_value(_args, "--offset") or 0,
|
|
offset=_read_flag_value(_args, "--offset") or 0,
|
|
|
limit=_read_flag_value(_args, "--limit"),
|
|
limit=_read_flag_value(_args, "--limit"),
|
|
|
top_limit=_read_flag_value(_args, "--top-limit"),
|
|
top_limit=_read_flag_value(_args, "--top-limit"),
|