增加了项目侧关于steps的处理。允许保存和提取steps信息。
This commit is contained in:
@@ -93,7 +93,13 @@ class UnitsApiHandler(BaseApiHandler):
|
||||
continue
|
||||
|
||||
origin_data = node.get_origin_data() or {}
|
||||
update_data = self._filter_update_data(node_data, origin_data, PostGeneratorUnits)
|
||||
force_steps_update = self._steps_changed(node)
|
||||
update_data = self._filter_update_data(
|
||||
node_data,
|
||||
origin_data,
|
||||
PostGeneratorUnits,
|
||||
force_full_schema=force_steps_update,
|
||||
)
|
||||
if not update_data:
|
||||
reason = f"No physical diff found for units {node.data_id} despite strategy update request (Normalization Discrepancy)."
|
||||
print(f" [WARNING] [units] {reason}")
|
||||
@@ -114,7 +120,14 @@ class UnitsApiHandler(BaseApiHandler):
|
||||
continue
|
||||
|
||||
try:
|
||||
await api_update_units(self.api_client, update_model, push_id, biz_id)
|
||||
await api_update_units(
|
||||
self.api_client,
|
||||
update_model,
|
||||
push_id,
|
||||
biz_id,
|
||||
steps=self._get_request_steps(node),
|
||||
)
|
||||
self._mark_approval_snapshot_synced(node)
|
||||
results.append(TaskResult.success(node_id=node.node_id))
|
||||
except Exception as e:
|
||||
results.append(TaskResult.failed(node_id=node.node_id, error=str(e)))
|
||||
@@ -143,7 +156,14 @@ class UnitsApiHandler(BaseApiHandler):
|
||||
|
||||
# ========== 静态 API 函数 ==========
|
||||
|
||||
async def api_update_units(client, data: PostGeneratorUnits, push_id: str, biz_id: str) -> None:
|
||||
async def api_update_units(
|
||||
client,
|
||||
data: PostGeneratorUnits,
|
||||
push_id: str,
|
||||
biz_id: str,
|
||||
*,
|
||||
steps: List[Dict[str, Any]] | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
PUT /units - 更新机组数据
|
||||
|
||||
@@ -153,7 +173,7 @@ async def api_update_units(client, data: PostGeneratorUnits, push_id: str, biz_i
|
||||
push_id: 推送ID
|
||||
biz_id: 业务ID
|
||||
"""
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True)}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data.model_dump(exclude_unset=True), "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/units", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
Reference in New Issue
Block a user