Skip to content

Commit a0754a8

Browse files
committed
feat (DFC Client): speedup getReplicas by sorting LFNs
1 parent bdcf074 commit a0754a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DIRAC/Resources/Catalog/FileCatalogClient.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def getReplicas(self, lfns, allStatus=False, timeout=120):
141141
successful = {}
142142
failed = {}
143143

144-
for chunk in breakListIntoChunks(lfns, GET_REPLICAS_CHUNK_SIZE):
144+
# We want to sort the lfns because of the way the server groups the db queries by
145+
# directory. So if we sort them, the grouping is more efficient.
146+
for chunk in breakListIntoChunks(sorted(lfns), GET_REPLICAS_CHUNK_SIZE):
145147
rpcClient = self._getRPC(timeout=timeout)
146148
result = rpcClient.getReplicas(chunk, allStatus)
147149

0 commit comments

Comments
 (0)