File indexing completed on 2024-11-25 02:29:50
0001
0002
0003
0004
0005 from builtins import range
0006 if __name__ == '__main__':
0007
0008 import PhysicsTools.HeppyCore.utils.eostools as eostools
0009 eostools.setCAFPath()
0010
0011 from cmsIO import *
0012 from cmsStage import *
0013
0014 import sys, time
0015
0016
0017 argv = sys.argv[1:]
0018 (args, debug, force ) = parseOpts( argv )
0019
0020 if not os.path.isfile(args[0]):
0021 print(args[0], 'does not exist.')
0022 sys.exit(1)
0023 source = cmsFile( args[0], "rfio" )
0024 destination = cmsFile( args[1], "stageout" )
0025 checkArgs( source, destination, force )
0026
0027
0028 dest = args[1]
0029 if eostools.isDirectory(dest):
0030 dest = os.path.join(dest,os.path.basename(args[0]))
0031
0032 sleep_lengths = [1,10,60,600,1800]
0033 return_code = 0
0034 for i in range(5):
0035
0036
0037 time.sleep(sleep_lengths[i])
0038
0039 try:
0040
0041 print('cmsStage %s [%d/5]' % (' '.join(argv) , i+1))
0042 main(argv)
0043
0044 except SystemExit as e:
0045 print("cmsStage exited with code '%s'. Retrying... [%d/5]" % ( str(e), i+1 ))
0046 return_code = e.code
0047
0048
0049 time.sleep(3)
0050
0051 if eostools.fileExists(dest) and eostools.isFile(dest):
0052 if source.size() == destination.size():
0053 return_code = 0
0054 break
0055
0056 sys.exit(return_code)