From 79c631b7dd0e692b8984fac07ed3f8cdf44edaa7 Mon Sep 17 00:00:00 2001 From: ARRABITO Luisa Date: Thu, 22 Aug 2024 11:31:55 +0200 Subject: [PATCH] fix (TS): use TransformationStatus --- .../TransformationSystem/DB/TransformationDB.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/DIRAC/TransformationSystem/DB/TransformationDB.py b/src/DIRAC/TransformationSystem/DB/TransformationDB.py index ccde0a9e84f..c0c1ccc86d0 100755 --- a/src/DIRAC/TransformationSystem/DB/TransformationDB.py +++ b/src/DIRAC/TransformationSystem/DB/TransformationDB.py @@ -15,6 +15,7 @@ from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Base.DB import DB from DIRAC.Core.Utilities.DErrno import cmpError +from DIRAC.TransformationSystem.Client import TransformationStatus from DIRAC.Resources.Catalog.FileCatalog import FileCatalog from DIRAC.Core.Security.ProxyInfo import getProxyInfo from DIRAC.Core.Utilities.List import stringListToString, intListToString, breakListIntoChunks @@ -1629,12 +1630,11 @@ def addFile(self, fileDicts, force=False, connection=False): fileIDs = [] for fileDict in res["Value"]: fileIDs.append(fileDict["FileID"]) - if fileDict["Status"] == "Deleted": - res = self.__setTransformationFileStatus(list(fileIDs), "Unused", connection=connection) + if fileDict["Status"] == TransformationStatus.DELETED: + res = self.__setTransformationFileStatus(list(fileIDs), TransformationStatus.UNUSED, connection=connection) if not res["OK"]: return res - res = self.__setDataFileStatus(list(fileIDs), "New", connection=connection) - if not res["OK"]: + if not (res := self.__setDataFileStatus(list(fileIDs), TransformationStatus.NEW, connection=connection)["OK"]: return res res = self.addFilesToTransformation(transID, lfns) @@ -1776,11 +1776,11 @@ def setMetadata(self, path, usermetadatadict, connection=False): fileIDs = [] for fileDict in res["Value"]: fileIDs.append(fileDict["FileID"]) - if fileDict["Status"] == "Deleted": - res = self.__setTransformationFileStatus(list(fileIDs), "Unused", connection=connection) + if fileDict["Status"] == TransformationStatus.DELETED: + res = self.__setTransformationFileStatus(list(fileIDs), TransformationStatus.UNUSED, connection=connection) if not res["OK"]: return res - res = self.__setDataFileStatus(list(fileIDs), "New", connection=connection) + res = self.__setDataFileStatus(list(fileIDs), TransformationStatus.NEW, connection=connection) if not res["OK"]: return res