|
@@ -22,6 +22,8 @@ os.environ.setdefault("AGENT_DISABLE_SIDE_BRANCHES", "1")
|
|
|
|
|
|
|
|
from dotenv import load_dotenv
|
|
from dotenv import load_dotenv
|
|
|
from examples.demand.db_manager import (
|
|
from examples.demand.db_manager import (
|
|
|
|
|
+ DEFAULT_DEMAND_PLATFORM,
|
|
|
|
|
+ normalize_platform,
|
|
|
query_category_level,
|
|
query_category_level,
|
|
|
query_latest_success_execution_id,
|
|
query_latest_success_execution_id,
|
|
|
query_video_ids_by_names,
|
|
query_video_ids_by_names,
|
|
@@ -64,6 +66,12 @@ MYSQL_ENTRYPOINT_ENV = "DEMAND_MYSQL_ENTRYPOINT"
|
|
|
MYSQL_ENTRYPOINT_NAMES = {"run_existing_execution_mysql", "run_hive_gap_mysql"}
|
|
MYSQL_ENTRYPOINT_NAMES = {"run_existing_execution_mysql", "run_hive_gap_mysql"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def _resolve_run_platform(platform_type: Optional[str], demand_scope: Optional[dict[str, Any]]) -> str:
|
|
|
|
|
+ scope = demand_scope if isinstance(demand_scope, dict) else {}
|
|
|
|
|
+ raw_platform = platform_type or scope.get("platform") or scope.get("platform_type") or DEFAULT_DEMAND_PLATFORM
|
|
|
|
|
+ return normalize_platform(raw_platform)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def _is_local_json_mode() -> bool:
|
|
def _is_local_json_mode() -> bool:
|
|
|
return os.getenv("DEMAND_OUTPUT_MODE", "").strip().lower() == LOCAL_JSON_MODE
|
|
return os.getenv("DEMAND_OUTPUT_MODE", "").strip().lower() == LOCAL_JSON_MODE
|
|
|
|
|
|
|
@@ -774,6 +782,7 @@ async def run_once(
|
|
|
if _is_local_json_mode() or _is_mysql_demand_content_mode():
|
|
if _is_local_json_mode() or _is_mysql_demand_content_mode():
|
|
|
_ensure_pg_weight_score_files(int(execution_id))
|
|
_ensure_pg_weight_score_files(int(execution_id))
|
|
|
|
|
|
|
|
|
|
+ platform_type = _resolve_run_platform(platform_type, demand_scope)
|
|
|
TopicBuildAgentContext.set_execution_id(execution_id)
|
|
TopicBuildAgentContext.set_execution_id(execution_id)
|
|
|
TopicBuildAgentContext.set_metadata("result_base_dir", str(_get_result_base_dir()))
|
|
TopicBuildAgentContext.set_metadata("result_base_dir", str(_get_result_base_dir()))
|
|
|
TopicBuildAgentContext.set_metadata("merge_leve2", merge_level2)
|
|
TopicBuildAgentContext.set_metadata("merge_leve2", merge_level2)
|
|
@@ -781,8 +790,7 @@ async def run_once(
|
|
|
resolved_demand_scope = dict(demand_scope or {})
|
|
resolved_demand_scope = dict(demand_scope or {})
|
|
|
resolved_demand_scope.setdefault("scope_source", "manual_cli")
|
|
resolved_demand_scope.setdefault("scope_source", "manual_cli")
|
|
|
resolved_demand_scope.setdefault("merge_leve2", merge_level2)
|
|
resolved_demand_scope.setdefault("merge_leve2", merge_level2)
|
|
|
- if platform_type:
|
|
|
|
|
- resolved_demand_scope.setdefault("platform", platform_type)
|
|
|
|
|
|
|
+ resolved_demand_scope["platform"] = _resolve_run_platform(platform_type, resolved_demand_scope)
|
|
|
resolved_demand_scope.setdefault("pattern_execution_id", int(execution_id))
|
|
resolved_demand_scope.setdefault("pattern_execution_id", int(execution_id))
|
|
|
TopicBuildAgentContext.set_metadata("demand_scope", resolved_demand_scope)
|
|
TopicBuildAgentContext.set_metadata("demand_scope", resolved_demand_scope)
|
|
|
|
|
|
|
@@ -974,6 +982,7 @@ async def main(
|
|
|
if str(cluster_name).strip() == "全局树":
|
|
if str(cluster_name).strip() == "全局树":
|
|
|
raise ValueError("mysql_demand_content 模式只写普通 demand_content,不支持全局树 Hive 输出")
|
|
raise ValueError("mysql_demand_content 模式只写普通 demand_content,不支持全局树 Hive 输出")
|
|
|
|
|
|
|
|
|
|
+ platform_type = _resolve_run_platform(platform_type, demand_scope)
|
|
|
if execution_id is None:
|
|
if execution_id is None:
|
|
|
execution_id = get_execution_id_by_merge_level2(cluster_name)
|
|
execution_id = get_execution_id_by_merge_level2(cluster_name)
|
|
|
if not execution_id:
|
|
if not execution_id:
|