fileSpec = FileSpec() fileSpec.fileType = 'es_output' fileSpec.lfn = 'panda.sgotest.' + uuid.uuid4().hex + '.gz' fileSpec.fileAttributes = {} assFileSpec = FileSpec() assFileSpec.lfn = 'panda.sgotest.' + uuid.uuid4().hex assFileSpec.fileType = 'es_output' assFileSpec.fsize = random.randint(10, 100) # create source file hash = hashlib.md5() hash.update('%s:%s' % (scope, fileSpec.lfn)) hash_hex = hash.hexdigest() correctedscope = "/".join(scope.split('.')) assFileSpec.path = "{endPoint}/{scope}/{hash1}/{hash2}/{lfn}".format( endPoint=queueConfig.stager['Globus_srcPath'], scope=correctedscope, hash1=hash_hex[0:2], hash2=hash_hex[2:4], lfn=assFileSpec.lfn) if not os.path.exists(os.path.dirname(assFileSpec.path)): print "os.makedirs({})".format(os.path.dirname(assFileSpec.path)) os.makedirs(os.path.dirname(assFileSpec.path)) oFile = open(assFileSpec.path, 'w') oFile.write(''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize))) oFile.close() fileSpec.add_associated_file(assFileSpec) jobSpec = JobSpec() jobSpec.jobParams = { 'outFiles': fileSpec.lfn + ',log',
atexit.register(exit_func) queueName = sys.argv[1] queueConfigMapper = QueueConfigMapper() queueConfig = queueConfigMapper.get_queue(queueName) fileSpec = FileSpec() fileSpec.fileType = 'output' fileSpec.lfn = file_prefix + uuid.uuid4().hex + '.gz' fileSpec.fileAttributes = {'guid': str(uuid.uuid4())} fileSpec.checksum = '0d439274' assFileSpec = FileSpec() assFileSpec.lfn = file_prefix + uuid.uuid4().hex assFileSpec.fileType = 'es_output' assFileSpec.fsize = random.randint(10, 100) assFileSpec.path = os.getcwd() + '/' + assFileSpec.lfn oFile = open(assFileSpec.lfn, 'w') oFile.write(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize))) oFile.close() fileSpec.add_associated_file(assFileSpec) jobSpec = JobSpec() jobSpec.jobParams = {'outFiles': fileSpec.lfn + ',log', 'scopeOut': 'panda', 'scopeLog': 'panda', 'logFile': 'log', 'realDatasets': 'panda.' + fileSpec.lfn, 'ddmEndPointOut': 'BNL-OSG2_DATADISK', } jobSpec.add_out_file(fileSpec) pluginFactory = PluginFactory()
fileSpec.lfn = assFileSpec.lfn + '.gz' fileSpec.scope = 'panda' outFiles_scope_str += 'panda,' outFiles_str += fileSpec.lfn + ',' realDatasets_str += realDataset + "," ddmEndPointOut_str += ddmEndPointOut + "," assFileSpec.fileType = 'es_output' assFileSpec.fsize = random.randint(10, 100) # create source file hash = hashlib.md5() hash.update('%s:%s' % (scope, fileSpec.lfn)) hash_hex = hash.hexdigest() correctedscope = "/".join(scope.split('.')) assFileSpec.path = "{endPoint}/{scope}/{hash1}/{hash2}/{lfn}".format(endPoint=queueConfig.stager['Globus_srcPath'], scope=correctedscope, hash1=hash_hex[0:2], hash2=hash_hex[2:4], lfn=assFileSpec.lfn) if not os.path.exists(os.path.dirname(assFileSpec.path)): tmpLog.debug("os.makedirs({})".format(os.path.dirname(assFileSpec.path))) os.makedirs(os.path.dirname(assFileSpec.path)) oFile = open(assFileSpec.path, 'w') oFile.write(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize))) oFile.close() fileSpec.path = assFileSpec.path + '.gz' fileSpec.add_associated_file(assFileSpec) #print "dump(fileSpec)" #dump(fileSpec) # add output file to jobSpec jobSpec.add_out_file(fileSpec) #
fileSpec.scope = 'panda' inFiles_scope_str += 'panda,' inFiles_str += fileSpec.lfn + ',' realDatasets_str += realDataset + "," realDatasetsIn_str += realDataset + "," ddmEndPointIn_str += ddmEndPointIn + "," assFileSpec.fileType = 'input' assFileSpec.fsize = random.randint(10, 100) # create source file hash = hashlib.md5() hash.update('%s:%s' % (fileSpec.scope, fileSpec.lfn)) hash_hex = hash.hexdigest() correctedscope = "/".join(scope.split('.')) fileSpec.path = "{endPoint}/{scope}/{hash1}/{hash2}/{lfn}".format(endPoint=queueConfig.preparator['Globus_dstPath'], scope=correctedscope, hash1=hash_hex[0:2], hash2=hash_hex[2:4], lfn=fileSpec.lfn) assFileSpec.path = fileSpec.path fileSpec.add_associated_file(assFileSpec) # add input file to jobSpec jobSpec.add_in_file(fileSpec) # now create the temporary file tmpfile_path = "{mountPoint}/testdata/{lfn}".format(mountPoint=queueConfig.preparator['basePath'], lfn=assFileSpec.lfn) if not os.path.exists(os.path.dirname(tmpfile_path)): tmpLog.debug("os.makedirs({})".format(os.path.dirname(tmpfile_path))) os.makedirs(os.path.dirname(tmpfile_path)) oFile = open(tmpfile_path, 'w') oFile.write(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize)))
# some dummy inputs GUID_str += 'd82e8e5e301b77489fd4da04bcdd6565,' fsize_str += '3084569129,' checksum_str += 'ad:9f60d29f,' scope_in_str += 'panda,' # assFileSpec.fileType = 'input' assFileSpec.fsize = random.randint(10, 100) # create source file hash = hashlib.md5() hash.update(('%s:%s' % (fileSpec.scope, fileSpec.lfn)).encode('utf-8')) hash_hex = hash.hexdigest() correctedscope = "/".join(scope.split('.')) fileSpec.path = "{endPoint}/{scope}/{hash1}/{hash2}/{lfn}".format( endPoint=queueConfig.preparator['Globus_dstPath'], scope=correctedscope, hash1=hash_hex[0:2], hash2=hash_hex[2:4], lfn=fileSpec.lfn) assFileSpec.path = fileSpec.path fileSpec.add_associated_file(assFileSpec) # now create the temporary file tmpfile_path = "{mountPoint}/testdata/{lfn}".format( mountPoint=queueConfig.preparator['basePath'], lfn=assFileSpec.lfn) if not os.path.exists(os.path.dirname(tmpfile_path)): tmpLog.debug("os.makedirs({})".format(os.path.dirname(tmpfile_path))) os.makedirs(os.path.dirname(tmpfile_path)) oFile = open(tmpfile_path, 'w') oFile.write(''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize))) oFile.close()
atexit.register(exit_func) queueName = sys.argv[1] queueConfigMapper = QueueConfigMapper() queueConfig = queueConfigMapper.get_queue(queueName) fileSpec = FileSpec() fileSpec.fileType = 'output' fileSpec.lfn = file_prefix + uuid.uuid4().hex + '.gz' fileSpec.fileAttributes = {'guid': str(uuid.uuid4())} fileSpec.checksum = '0d439274' assFileSpec = FileSpec() assFileSpec.lfn = file_prefix + uuid.uuid4().hex assFileSpec.fileType = 'es_output' assFileSpec.fsize = random.randint(10, 100) assFileSpec.path = os.getcwd() + '/' + assFileSpec.lfn oFile = open(assFileSpec.lfn, 'w') oFile.write(''.join( random.choice(string.ascii_uppercase + string.digits) for _ in range(assFileSpec.fsize))) oFile.close() fileSpec.add_associated_file(assFileSpec) jobSpec = JobSpec() jobSpec.jobParams = { 'outFiles': fileSpec.lfn + ',log', 'scopeOut': 'panda', 'scopeLog': 'panda', 'logFile': 'log', 'realDatasets': 'panda.' + fileSpec.lfn, 'ddmEndPointOut': 'BNL-OSG2_DATADISK', }