Skip to content

Commit

Permalink
fix: Optimise usage of getTransformationFiles in TransformationCLI
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Oct 17, 2024
1 parent 2f5c0c2 commit 3b46ca9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/DIRAC/TransformationSystem/Client/TransformationCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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"]:
Expand All @@ -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:
Expand Down

0 comments on commit 3b46ca9

Please sign in to comment.