From 97d5f3b63f4fa09a977b837a9a8cd0c9503813a7 Mon Sep 17 00:00:00 2001 From: "Yunior C. Fonseca Reyna" Date: Tue, 28 Apr 2026 22:38:14 +0200 Subject: [PATCH] Fixing some output contract --- app/backend/api/services/project_service.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/backend/api/services/project_service.py b/app/backend/api/services/project_service.py index 790f224..8ce8468 100644 --- a/app/backend/api/services/project_service.py +++ b/app/backend/api/services/project_service.py @@ -1628,7 +1628,7 @@ def attachContainerWizardMetadata(container: Optional[Dict[str, Any]]) -> None: container["wizards"] = wizardItems container["wizard"] = wizardItems[0] if wizardItems else None - headerParams = ['runName', '_objComment', '_useQueue', '_prerequisites', 'gpuList', 'numberOfThreads'] + headerParams = ['runName', '_objComment', '_useQueue', '_prerequisites', 'gpuList', 'numberOfThreads', 'numberOfMpi'] package = protocol.getClassPackage() hasExpert = protocol.hasExpert() if hasExpert: @@ -1894,6 +1894,8 @@ def attachContainerWizardMetadata(container: Optional[Dict[str, Any]]) -> None: paramValue = protocol.getScipionThreads() elif paramName == 'gpuList': paramValue = protocol.gpuList.get() + elif paramName == 'numberOfMpi': + paramValue = protocol.getMPIs() sectionData["params"].append(paramProcessed) @@ -2969,13 +2971,17 @@ def getProtocolLogs(self, projectId: int, protocolId: int, @staticmethod def _buildProtocolMutationResult(message: str, **extra) -> Dict[str, Any]: - result = { - "status": 1 if extra['errors'] else 0, - "errors": extra['errors'], + errors = extra.get("errors", []) + duplicated = extra.get("duplicated", {}) + result = dict(extra or {}) + + result.update({ + "status": 1 if errors else 0, + "errors": errors, "message": message, - "duplicated": extra['duplicated'] - } - result.update(extra or {}) + "duplicated": duplicated, + }) + return result def renameProtocol(self, protocolId, newName):