Skip to content

Commit 1901155

Browse files
committed
Only look for closest cache once on directory listing
Fixes #80
1 parent 6ae57d2 commit 1901155

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

bin/stashcp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ def parse_job_ad():
276276

277277
def dostashcpdirectory(sourceDir, destination, cache, debug=False):
278278
sourceItems = subprocess.Popen(["xrdfs", stash_origin, "ls", sourceDir], stdout=subprocess.PIPE).communicate()[0].split()
279+
280+
# If the cache is not specified by the command line, then look for the closest
281+
# Do it here, so that we only do it once per stashcp call. Though, if everything is in
282+
# CVMFS, then this is unncessary.
283+
if not cache:
284+
cache = get_best_stashcache()
285+
logging.debug("Using Cache %s", cache)
286+
279287
for remote_file in sourceItems:
280288
command2 = 'xrdfs ' + stash_origin + ' stat '+ remote_file + ' | grep "IsDir" | wc -l'
281289
isdir=subprocess.Popen([command2],stdout=subprocess.PIPE,shell=True).communicate()[0].split()[0]

0 commit comments

Comments
 (0)