@@ -125,7 +125,7 @@ def getToken():
125125 if os .path .exists (os .path .join (os .environ ["_CONDOR_CREDS" ], "scitokens.use" )):
126126 scitoken_file = os .path .join (os .environ ["_CONDOR_CREDS" ], "scitokens.use" )
127127 elif os .path .exists (".condor_creds/scitokens.use" ):
128- scitoken_file = os .path .join ( os . path . abspath (".condor_creds/scitokens.use" ) )
128+ scitoken_file = os .path .abspath (".condor_creds/scitokens.use" )
129129
130130 if not scitoken_file or not os .path .exists (scitoken_file ):
131131 logging .info ("Unable to find token file" )
@@ -237,6 +237,7 @@ def doStashCpSingle(sourceFile, destination, methods, debug=False):
237237 payload ['filesize' ] = os .stat (final_destination ).st_size
238238 payload ['download_size' ] = payload ['filesize' ]
239239 else :
240+ logging .error ("All methods failed! Unable to download file." )
240241 payload ['status' ] = 'Fail'
241242
242243 es_send (payload )
@@ -246,10 +247,7 @@ def doStashCpSingle(sourceFile, destination, methods, debug=False):
246247def download_cvmfs (sourceFile , destination , debug , payload ):
247248
248249 # First, check if the file is available in CVMFS
249- if sourceFile [0 ] == '/' :
250- cvmfs_file = os .path .join ("/cvmfs/stash.osgstorage.org/" , sourceFile [1 :])
251- else :
252- cvmfs_file = os .path .join ("/cvmfs/stash.osgstorage.org/" , sourceFile )
250+ cvmfs_file = os .path .join ("/cvmfs/stash.osgstorage.org" , sourceFile .lstrip ("/" ))
253251 logging .debug ("Checking if the CVMFS file exists: %s" , cvmfs_file )
254252 if os .path .exists (cvmfs_file ):
255253 try :
@@ -262,7 +260,7 @@ def download_cvmfs(sourceFile, destination, debug, payload):
262260 return True
263261
264262 except IOError as e :
265- logging .error ("Unable to copy with CVMFS, even though file exists: %s" , str (e ))
263+ logging .warning ("Unable to copy with CVMFS, even though file exists: %s" , str (e ))
266264 return False
267265
268266 else :
@@ -555,10 +553,10 @@ def get_best_stashcache():
555553 if caches_json_location and os .path .exists (caches_json_location ):
556554 cache_files = [ caches_json_location ]
557555 else :
558- prefix = os .environ .get ("OSG_LOCATION" , "" )
556+ prefix = os .environ .get ("OSG_LOCATION" , "/ " )
559557 cache_files = [os .path .join (os .path .dirname (os .path .realpath (__file__ )), "caches.json" ),
560- os .path .join (prefix , "/ etc/stashcache/caches.json" ),
561- os .path .join (prefix , "/ usr/share/stashcache/caches.json" )]
558+ os .path .join (prefix , "etc/stashcache/caches.json" ),
559+ os .path .join (prefix , "usr/share/stashcache/caches.json" )]
562560 if resource_string :
563561 cache_files .insert (0 , resource_string (__name__ , 'caches.json' ))
564562
@@ -626,7 +624,7 @@ def get_best_stashcache():
626624 minsite = random .choice (caches_list )['name' ]
627625 random .shuffle (caches_list )
628626 nearest_cache_list = [cache ['name' ] for cache in caches_list ]
629- logging .error ("Unable to use Geoip to find closest cache! Returning random cache %s" , minsite )
627+ logging .warning ("Unable to use Geoip to find closest cache! Returning random cache %s" , minsite )
630628 logging .debug ("Ordered list of nearest caches: %s" , str (nearest_cache_list ))
631629 return minsite
632630 else :
0 commit comments