Skip to content

Commit ce09773

Browse files
authored
Merge pull request #8165 from chaen/v9.0_feat_fileCOuntClient
feat (TS): cast getTransformationFilesCount at the client level
2 parents 46142b7 + 8718c99 commit ce09773

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/DIRAC/TransformationSystem/Client/TransformationClient.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from DIRAC import S_OK, S_ERROR, gLogger
44
from DIRAC.Core.Base.Client import Client, createClient
55
from DIRAC.Core.Utilities.List import breakListIntoChunks
6-
from DIRAC.Core.Utilities.JEncode import decode as jdecode
6+
from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue, returnValueOrRaise
7+
from DIRAC.Core.Utilities.JEncode import decode as jdecode, strToIntDict
78
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
89
from DIRAC.TransformationSystem.Client import TransformationStatus
910
from DIRAC.TransformationSystem.Client import TransformationFilesStatus
@@ -591,3 +592,19 @@ def isOK(self):
591592
def addDirectory(self, path, force=False):
592593
rpcClient = self._getRPC()
593594
return rpcClient.addDirectory(path, force)
595+
596+
@convertToReturnValue
597+
def getTransformationFilesCount(self, transName, field, selection=None, **kwargs):
598+
if not selection:
599+
selection = {}
600+
rpcClient = self._getRPC(**kwargs)
601+
602+
files_count = returnValueOrRaise(rpcClient.getTransformationFilesCount(transName, field, selection))
603+
# Some of these fields are LHCb specific, however:
604+
# * it seems only LHCb uses this method
605+
# * it will not be necessary with diracx & pydantic anymore
606+
if field in ["TransformationID", "FileID", "TaskID", "ErrorCount", "RunNumber", "Size"]:
607+
total = files_count.pop("Total")
608+
files_count = strToIntDict(files_count)
609+
files_count["Total"] = total
610+
return files_count

0 commit comments

Comments
 (0)