|
3 | 3 | from DIRAC import S_OK, S_ERROR, gLogger
|
4 | 4 | from DIRAC.Core.Base.Client import Client, createClient
|
5 | 5 | 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 |
7 | 8 | from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
|
8 | 9 | from DIRAC.TransformationSystem.Client import TransformationStatus
|
9 | 10 | from DIRAC.TransformationSystem.Client import TransformationFilesStatus
|
@@ -591,3 +592,19 @@ def isOK(self):
|
591 | 592 | def addDirectory(self, path, force=False):
|
592 | 593 | rpcClient = self._getRPC()
|
593 | 594 | 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