本文整理汇总了Python中Ganga.Lib.LCG.Grid.expandjdl方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.expandjdl方法的具体用法?Python Grid.expandjdl怎么用?Python Grid.expandjdl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ganga.Lib.LCG.Grid
的用法示例。
在下文中一共展示了Grid.expandjdl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preparejob
# 需要导入模块: from Ganga.Lib.LCG import Grid [as 别名]
# 或者: from Ganga.Lib.LCG.Grid import expandjdl [as 别名]
#.........这里部分代码省略.........
if idx['remote']:
abspath = os.path.abspath(f)
fsize = os.path.getsize(abspath)
if fsize > max_prestaged_fsize:
max_prestaged_fsize = fsize
input_sandbox_uris.append(
idx['remote'][os.path.basename(f)])
input_sandbox_names.append(
os.path.basename(urlparse(f)[2]))
if idx['local']:
input_sandbox_uris += idx['local']
input_sandbox_names.append(os.path.basename(f))
if not ick:
logger.error('stop job submission')
return None
# determin the lcg-cp timeout according to the max_prestaged_fsize
# - using the assumption of 1 MB/sec.
max_prestaged_fsize = 0
lfc_host = ''
transfer_timeout = config['SandboxTransferTimeout']
predict_timeout = int(math.ceil(max_prestaged_fsize / 1000000.0))
if predict_timeout > transfer_timeout:
transfer_timeout = predict_timeout
if transfer_timeout < 60:
transfer_timeout = 60
script = script.replace(
'###TRANSFERTIMEOUT###', '%d' % transfer_timeout)
# update the job wrapper with the inputsandbox list
script = script.replace(
'###INPUTSANDBOX###', repr({'remote': {}, 'local': input_sandbox_names}))
# write out the job wrapper and put job wrapper into job's inputsandbox
scriptPath = inpw.writefile(
FileBuffer('__jobscript_%s__' % job.getFQID('.'), script), executable=1)
input_sandbox = input_sandbox_uris + [scriptPath]
for isb in input_sandbox:
logger.debug('ISB URI: %s' % isb)
# compose output sandbox to include by default the following files:
# - gzipped stdout (transferred only when the JobLogHandler is WMS)
# - gzipped stderr (transferred only when the JobLogHandler is WMS)
# - __jobscript__.log (job wrapper's log)
output_sandbox = [wrapperlog]
from Ganga.GPIDev.Lib.File.OutputFileManager import getOutputSandboxPatterns
for outputSandboxPattern in getOutputSandboxPatterns(job):
output_sandbox.append(outputSandboxPattern)
if config['JobLogHandler'] in ['WMS']:
output_sandbox += ['stdout.gz', 'stderr.gz']
if len(jobconfig.outputbox):
output_sandbox += [Sandbox.OUTPUT_TARBALL_NAME]
# compose LCG JDL
jdl = {
'VirtualOrganisation': config['VirtualOrganisation'],
'Executable': os.path.basename(scriptPath),
'Environment': {'GANGA_LCG_VO': config['VirtualOrganisation'], 'GANGA_LOG_HANDLER': config['JobLogHandler'], 'LFC_HOST': lfc_host},
'StdOutput': 'stdout',
'StdError': 'stderr',
'InputSandbox': input_sandbox,
'OutputSandbox': output_sandbox,
'OutputSandboxBaseDestURI': 'gsiftp://localhost'
}
jdl['Environment'].update({'GANGA_LCG_CE': self.CE})
jdl['Requirements'] = self.requirements.merge(
jobconfig.requirements).convert()
if self.jobtype.upper() in ['NORMAL', 'MPICH']:
jdl['JobType'] = self.jobtype.upper()
if self.jobtype.upper() == 'MPICH':
#jdl['Requirements'].append('(other.GlueCEInfoTotalCPUs >= NodeNumber)')
jdl['Requirements'].append(
'Member("MPICH",other.GlueHostApplicationSoftwareRunTimeEnvironment)')
jdl['NodeNumber'] = self.requirements.nodenumber
else:
logger.warning('JobType "%s" not supported' % self.jobtype)
return
# additional settings from the job
# if jobconfig.env:
# jdl['Environment'].update(jobconfig.env)
jdlText = Grid.expandjdl(jdl)
logger.debug('subjob JDL: %s' % jdlText)
return inpw.writefile(FileBuffer('__jdlfile__', jdlText))