From 3d62e8bf6cf78b624ae3378277c88408b88002af Mon Sep 17 00:00:00 2001 From: ZiWei <131428629+ZiWei09@users.noreply.github.com> Date: Sun, 23 Nov 2025 13:27:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(bioyond):=20=E4=BC=98=E5=8C=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=9B=E5=BB=BA=E6=B5=81=E7=A8=8B=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E6=97=A0=E8=AE=BA=E6=88=90=E5=8A=9F=E4=B8=8E=E5=90=A6?= =?UTF-8?q?=E9=83=BD=E6=B8=85=E7=90=86=E4=BB=BB=E5=8A=A1=E9=98=9F=E5=88=97?= =?UTF-8?q?=E4=BB=A5=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D=E7=B4=AF=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bioyond_studio/reaction_station.py | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/unilabos/devices/workstation/bioyond_studio/reaction_station.py b/unilabos/devices/workstation/bioyond_studio/reaction_station.py index ffb83fd..43deda3 100644 --- a/unilabos/devices/workstation/bioyond_studio/reaction_station.py +++ b/unilabos/devices/workstation/bioyond_studio/reaction_station.py @@ -1291,14 +1291,22 @@ class BioyondReactionStation(BioyondWorkstation): "paramValues": {} }] - result = self.create_order(json.dumps(order_params)) - - if not result: - return self._create_error_result("创建任务失败", "create_order") - - # 清空工作流序列和参数,防止下次执行时累积重复 - self.pending_task_params = [] - self.clear_workflows() # 清空工作流序列,避免重复累积 + # 尝试创建订单:无论成功或失败,都需要在本次尝试结束后清理本地队列,避免下一次重复累积 + try: + result = self.create_order(json.dumps(order_params)) + if not result: + # 返回错误结果之前先记录情况(稍后由 finally 清理队列) + print("⚠️ 创建任务返回空或失败响应,稍后将清理本地队列以避免重复累积") + return self._create_error_result("创建任务失败", "create_order") + finally: + # 无论任务创建成功与否,都要清空本地保存的参数和工作流序列,防止下次重复 + try: + self.pending_task_params = [] + self.clear_workflows() # 清空工作流序列,避免重复累积 + print("✅ 已清理 pending_task_params 与 workflow_sequence") + except Exception as _ex: + # 记录清理失败,但不要阻塞原始返回 + print(f"❌ 清理队列时发生异常: {_ex}") # print(f"\n✅ 任务创建成功: {result}") # print(f"\n✅ 任务创建成功")