From 3b46ca9ad297205ae26729c70c72d8f156da2482 Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Thu, 17 Oct 2024 10:46:43 +0200 Subject: [PATCH] fix: Optimise usage of getTransformationFiles in TransformationCLI --- .../Client/TransformationCLI.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/DIRAC/TransformationSystem/Client/TransformationCLI.py b/src/DIRAC/TransformationSystem/Client/TransformationCLI.py index 4108da6fa88..f99691c55b1 100644 --- a/src/DIRAC/TransformationSystem/Client/TransformationCLI.py +++ b/src/DIRAC/TransformationSystem/Client/TransformationCLI.py @@ -371,13 +371,12 @@ def do_getFiles(self, args): selectDict = {"TransformationID": res["Value"]["TransformationID"]} if status: selectDict["Status"] = status - res = self.transClient.getTransformationFiles(condDict=selectDict) + columns = ["LFN", "Status", "ErrorCount", "TargetSE", "LastUpdate"] + res = self.transClient.getTransformationFiles(condDict=selectDict, columns=columns) if not res["OK"]: print(f"Failed to get transformation files: {res['Message']}") elif res["Value"]: - self._printFormattedDictList( - res["Value"], ["LFN", "Status", "ErrorCount", "TargetSE", "LastUpdate"], "LFN", "LFN" - ) + self._printFormattedDictList(res["Value"], columns, "LFN", "LFN") else: print("No files found") @@ -398,7 +397,8 @@ def do_getFileStatus(self, args): print(f"Failed to get transformation information: {res['Message']}") else: selectDict = {"TransformationID": res["Value"]["TransformationID"]} - res = self.transClient.getTransformationFiles(condDict=selectDict) + columns = ["LFN", "Status", "ErrorCount", "TargetSE", "LastUpdate"] + res = self.transClient.getTransformationFiles(condDict=selectDict, columns=columns) if not res["OK"]: print(f"Failed to get transformation files: {res['Message']}") elif res["Value"]: @@ -407,9 +407,7 @@ def do_getFileStatus(self, args): if fileDict["LFN"] in lfns: filesList.append(fileDict) if filesList: - self._printFormattedDictList( - filesList, ["LFN", "Status", "ErrorCount", "TargetSE", "LastUpdate"], "LFN", "LFN" - ) + self._printFormattedDictList(filesList, columns, "LFN", "LFN") else: print("Could not find any LFN in", lfns, "for transformation", transName) else: