From 931b87f17b158a1cc0ce0336edca9573cd8ca808 Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Tue, 5 Nov 2024 13:41:18 +0100 Subject: [PATCH] fix: deprecated getTransformationFilesAsJsonString --- .../Client/TransformationClient.py | 4 +-- .../DB/TransformationDB.py | 8 +---- .../Service/TransformationManagerHandler.py | 29 +++++++++---------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/DIRAC/TransformationSystem/Client/TransformationClient.py b/src/DIRAC/TransformationSystem/Client/TransformationClient.py index 25d2266be71..2ff3945e45f 100644 --- a/src/DIRAC/TransformationSystem/Client/TransformationClient.py +++ b/src/DIRAC/TransformationSystem/Client/TransformationClient.py @@ -177,7 +177,7 @@ def getTransformationFiles( timeStamp = "LastUpdate" if "LFN" not in condDict: - res = rpcClient.getTransformationFilesAsJsonString( + res = rpcClient.getTransformationFiles( condDict, older, newer, timeStamp, orderAttribute, offset, maxfiles, columns ) if not res["OK"]: @@ -208,7 +208,7 @@ def getTransformationFiles( # Apply the offset to the list of LFNs condDict["LFN"] = lfnList[offsetToApply : offsetToApply + limit] # No limit and no offset as the list is limited already - res = rpcClient.getTransformationFilesAsJsonString( + res = rpcClient.getTransformationFiles( condDict, older, newer, timeStamp, orderAttribute, None, None, columns ) if not res["OK"]: diff --git a/src/DIRAC/TransformationSystem/DB/TransformationDB.py b/src/DIRAC/TransformationSystem/DB/TransformationDB.py index b69447644e1..bd6e734432d 100755 --- a/src/DIRAC/TransformationSystem/DB/TransformationDB.py +++ b/src/DIRAC/TransformationSystem/DB/TransformationDB.py @@ -595,7 +595,6 @@ def getTransformationFiles( offset=None, connection=False, columns=None, - include_web_records=True, ): """Get files for the supplied transformations with support for the web standard structure""" connection = self.__getConnection(connection) @@ -634,12 +633,7 @@ def getTransformationFiles( resultList = [dict(zip(columns, row)) for row in res["Value"]] - result = S_OK(resultList) - if include_web_records: - webList = [[str(item) if not isinstance(item, int) else item for item in row] for row in res["Value"]] - result["Records"] = webList - result["ParameterNames"] = columns - return result + return S_OK(resultList) def getFileSummary(self, lfns, connection=False): """Get file status summary in all the transformations""" diff --git a/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py b/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py index 1bb5af6ca29..0f0e313e728 100644 --- a/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py +++ b/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py @@ -1,18 +1,18 @@ """ Service for interacting with TransformationDB """ -from DIRAC import S_OK, S_ERROR +from DIRAC import S_ERROR, S_OK +from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations from DIRAC.Core.DISET.RequestHandler import RequestHandler from DIRAC.Core.Security.Properties import SecurityProperty +from DIRAC.Core.Utilities.Decorators import deprecated from DIRAC.Core.Utilities.DEncode import ignoreEncodeWarning from DIRAC.Core.Utilities.JEncode import encode as jencode from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader -from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations +from DIRAC.RequestManagementSystem.Client.Operation import Operation +from DIRAC.RequestManagementSystem.Client.Request import Request from DIRAC.TransformationSystem.Client import TransformationFilesStatus from DIRAC.WorkloadManagementSystem.Client import JobStatus -from DIRAC.RequestManagementSystem.Client.Request import Request -from DIRAC.RequestManagementSystem.Client.Operation import Operation - TASKS_STATE_NAMES = ["TotalCreated", "Created"] + sorted( set(JobStatus.JOB_STATES) | set(Request.ALL_STATES) | set(Operation.ALL_STATES) @@ -292,11 +292,10 @@ def export_getTransformationFiles( limit=None, offset=None, columns=None, - include_web_records=True, ): if not condDict: condDict = {} - return self.transformationDB.getTransformationFiles( + result = self.transformationDB.getTransformationFiles( condDict=condDict, older=older, newer=newer, @@ -306,21 +305,21 @@ def export_getTransformationFiles( offset=offset, connection=False, columns=columns, - include_web_records=include_web_records, ) + # DEncode cannot cope with nested structures of multiple millions items. + # Encode everything as a json string, that DEncode can then transmit faster. + + return S_OK(jencode(result)) + types_getTransformationFilesAsJsonString = types_getTransformationFiles + @deprecated("Use getTransformationFiles instead") def export_getTransformationFilesAsJsonString(self, *args, **kwargs): """ - DEncode cannot cope with nested structures of multiple millions items. - Encode everything as a json string, that DEncode can then transmit faster. - - This will be the default as of v9.0 + Deprecated call -- redirect to getTransformationFiles """ - kwargs["include_web_records"] = False - res = self.export_getTransformationFiles(*args, **kwargs) - return S_OK(jencode(res)) + return self.export_getTransformationFiles(*args, **kwargs) #################################################################### #