本文整理汇总了Python中DIRAC.Interfaces.API.Job.Job.setCPUTime方法的典型用法代码示例。如果您正苦于以下问题:Python Job.setCPUTime方法的具体用法?Python Job.setCPUTime怎么用?Python Job.setCPUTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.Job.Job
的用法示例。
在下文中一共展示了Job.setCPUTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_execute
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def test_execute( self ):
job = Job()
job.setName( "helloWorld-test" )
job.setExecutable( find_all( "helloWorld.py", '.', 'Integration' )[0],
arguments = "This is an argument",
logFile = "aLogFileForTest.txt" ,
parameters=[('executable', 'string', '', "Executable Script"),
('arguments', 'string', '', 'Arguments for executable Script'),
( 'applicationLog', 'string', '', "Log file name" ),
( 'someCustomOne', 'string', '', "boh" )],
paramValues = [( 'someCustomOne', 'aCustomValue' )] )
job.setBannedSites( ['LCG.SiteA.com', 'DIRAC.SiteB.org'] )
job.setOwner( 'ownerName' )
job.setOwnerGroup( 'ownerGroup' )
job.setName( 'jobName' )
job.setJobGroup( 'jobGroup' )
job.setType( 'jobType' )
job.setDestination( 'DIRAC.someSite.ch' )
job.setCPUTime( 12345 )
job.setLogLevel( 'DEBUG' )
res = job.runLocal( self.d )
self.assertTrue( res['OK'] )
示例2: submitProbeJobs
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def submitProbeJobs(self, ce):
""" Submit some jobs to the CEs
"""
#need credentials, should be there since the initialize
from DIRAC.Interfaces.API.Dirac import Dirac
d = Dirac()
from DIRAC.Interfaces.API.Job import Job
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
import DIRAC
ops = Operations()
scriptname = ops.getValue("ResourceStatus/SofwareManagementScript", self.script)
j = Job()
j.setDestinationCE(ce)
j.setCPUTime(1000)
j.setName("Probe %s" % ce)
j.setJobGroup("SoftwareProbe")
j.setExecutable("%s/GlastDIRAC/ResourceStatusSystem/Client/%s" % (DIRAC.rootPath, scriptname),
logFile='SoftwareProbe.log')
j.setOutputSandbox('*.log')
res = d.submit(j)
if not res['OK']:
return res
return S_OK()
示例3: do_installonsite
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def do_installonsite(self,argss):
""" Install a release on a grid site :
installonsite tag site
"""
args = argss.split()
if len(args)<2:
print self.do_installonsite.__doc__
return
tag = args[0]
site = args[1]
#print "Check if the software with the tag '"+tag+"' exists on the rsync server..."
#res = self.client.getSitesForTag(tag)
#if not res['OK']:
#print res['Message']
#return
#print "tag found !"
from DIRAC.Interfaces.API.Dirac import Dirac
d = Dirac()
from DIRAC.Interfaces.API.Job import Job
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
import os
ops = Operations()
scriptname = "InstallSoftware.py"
j = Job()
j.setDestination(site)
j.setCPUTime(1000)
j.setName("Installation "+tag)
j.setExecutable(os.environ['DIRAC']+"/GlastDIRAC/ResourceStatusSystem/Client/"+scriptname , logFile='SoftwareInstallation.log')
j.setOutputSandbox('*.log')
res = d.submit(j)
if not res['OK']:
print "Could not submit the installation at site %s, message %s"%(site,res['Message'])
return
print "Job submitted, id = "+str(res['Value'])
print "Add tag :"
res = self.client.addTagAtSite(tag,site)
if not res['OK']:
print "Could not register tag %s at site %s, message %s"%(tag,site,res['Message'])
return
print "Added %s to %i CEs"%(tag,len(res['Value'][tag]))
示例4: submitJob
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def submitJob(jobPara):
dirac = Dirac()
j = Job()
j.setName(jobPara['jobName'])
j.setJobGroup(jobPara['jobGroup'])
j.setExecutable(jobPara['jobScript'], logFile = jobPara['jobScriptLog'])
j.setInputSandbox(jobPara['inputSandbox'])
j.setOutputSandbox(jobPara['outputSandbox'])
j.setOutputData(jobPara['outputData'], jobPara['SE'])
j.setDestination(jobPara['sites'])
j.setCPUTime(jobPara['CPUTime'])
result = dirac.submit(j)
if result['OK']:
print 'Job %s submitted successfully. ID = %d' %(jobPara['jobName'],result['Value'])
else:
print 'Job %s submitted failed' %jobPara['jobName']
return result
示例5: launch_batch_pict
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def launch_batch_pict( pitch_start, step, n_pict ):
j = Job()
j.setCPUTime(500)
j.setName('%s_%f' % (EXEC, pitch_start))
j.setJobGroup(JOBGROUP)
j.setInputSandbox([EXEC])
out_bmp_list=[]
pitch=pitch_start
for i in range(n_pict):
out_bmp='out_%f.bmp' % pitch
out_bmp_list.append(out_bmp)
j.setExecutable(EXEC,arguments="-W 600 -H 600 -X -0.77568377 -Y -0.13646737 -P %f -M 500 %s" % (pitch, out_bmp))
pitch+=step
j.setOutputSandbox(out_bmp_list + ["StdOut"] + ["StdErr"])
result = dirac.submit(j)
print 'Submission Result: ',result
return result
示例6: basicTest
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
def basicTest(self):
j = Job()
j.setCPUTime(50000)
j.setExecutable('/Users/stuart/dirac/workspace/DIRAC3/DIRAC/Interfaces/API/test/myPythonScript.py')
# j.setExecutable('/bin/echo hello')
j.setOwner('paterson')
j.setType('test')
j.setName('MyJobName')
#j.setAncestorDepth(1)
j.setInputSandbox(['/Users/stuart/dirac/workspace/DIRAC3/DIRAC/Interfaces/API/test/DV.opts','/Users/stuart/dirac/workspace/DIRAC3/DIRAC/Interfaces/API/test/DV2.opts'])
j.setOutputSandbox(['firstfile.txt','anotherfile.root'])
j.setInputData(['/lhcb/production/DC04/v2/DST/00000742_00003493_11.dst',
'/lhcb/production/DC04/v2/DST/00000742_00003493_10.dst'])
j.setOutputData(['my.dst','myfile.log'])
j.setDestination('LCG.CERN.ch')
j.setPlatform('LCG')
j.setSystemConfig('x86_64-slc5-gcc43-opt')
j.setSoftwareTags(['VO-lhcb-Brunel-v30r17','VO-lhcb-Boole-v12r10'])
#print j._toJDL()
#print j.printObj()
xml = j._toXML()
testFile = 'jobDescription.xml'
if os.path.exists(testFile):
os.remove(testFile)
xmlfile = open(testFile,'w')
xmlfile.write(xml)
xmlfile.close()
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Creating code for the workflow'
print j.createCode()
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Executing the workflow'
j.execute()
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Trying to run the same workflow from generated XML file'
workflow = fromXMLFile(testFile)
code = workflow.createCode()
print code
workflow.execute()
示例7: str
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
prodJobType = 'Merge'
transName = 'testProduction_' + str(int(time.time()))
desc = 'just test'
prodJob = Job()
prodJob._addParameter(prodJob.workflow, 'PRODUCTION_ID', 'string', '00012345', 'ProductionID')
prodJob._addParameter(prodJob.workflow, 'JOB_ID', 'string', '00006789', 'ProductionJobID')
prodJob._addParameter(prodJob.workflow, 'eventType', 'string', 'TestEventType', 'Event Type of the prodJobuction')
prodJob._addParameter(prodJob.workflow, 'numberOfEvents', 'string', '-1', 'Number of events requested')
prodJob._addParameter(prodJob.workflow, 'ProcessingType', 'JDL', str('Test'), 'ProductionGroupOrType')
prodJob._addParameter(prodJob.workflow, 'Priority', 'JDL', str(9), 'UserPriority')
prodJob.setType(prodJobType)
prodJob.workflow.setName(transName)
prodJob.workflow.setDescrShort(desc)
prodJob.workflow.setDescription(desc)
prodJob.setCPUTime(86400)
prodJob.setInputDataPolicy('Download')
prodJob.setExecutable('/bin/ls', '-l')
# Let's submit the prodJobuction now
#result = prodJob.create()
name = prodJob.workflow.getName()
name = name.replace('/', '').replace('\\', '')
prodJob.workflow.toXMLFile(name)
print 'Workflow XML file name is: %s' % name
workflowBody = ''
if os.path.exists(name):
with open(name, 'r') as fopen:
示例8: dexit
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
dexit(1)
os.chmod(executable,0755) # make file executable
input_sandbox_files.append(executable)
j.setExecutable(str(executable))
else:
gLogger.error("No executable defined.")
dexit(1)
j.setName("MC job")
if not opts.name is None:
j.setName(opts.name)
j.setInputSandbox(input_sandbox_files) # all input files in the sandbox
j.setOutputSandbox(output_sandbox_files)
j.setCPUTime(opts.cpu)
if not opts.site is None:
j.setDestination(opts.site.split(","))#can also be a list
if not opts.bannedSites is None:
j.setBannedSites(opts.bannedSites.split(","))
if not opts.release is None:
tag = opts.release
cl = SoftwareTagClient()
result = cl.getSitesForTag(tag,'Valid') # keyword doesn't work there.
if not result['OK']:
gLogger.error("*ERROR* Could not get sites for Tag %s"%tag,result['Message'])
dexit(1)
sites = result[ 'Value' ]
j.setDestination(sites)
示例9: int
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
print "Usage %s <scriptName> <jobName> <nbJobs>"%sys.argv[0]
sys.exit(1)
scriptName = sys.argv[1]
jobName = sys.argv[2]
nbJobs = int(sys.argv[3])
if not os.path.exists(jobName):
os.makedirs(jobName)
os.makedirs("%s/Done"%jobName)
os.makedirs("%s/Failed"%jobName)
else:
print "Folder %s exists"%jobName
sys.exit(1)
f = open("%s/jobIdList.txt"%jobName, 'w')
for i in xrange(nbJobs):
j = Job()
j.setCPUTime(10000)
j.setExecutable(scriptName)
j.addToOutputSandbox.append('myLog.txt')
j.addToOutputSandbox.append('clock.txt')
j.addToOutputSandbox.append('time.txt')
dirac = Dirac()
jobID = dirac.submit(j)
realId = jobID.get('JobID')
f.write("%s\n"%realId)
f.close()
示例10: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
from DIRAC.Core.Base import Script
Script.parseCommandLine()
from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Interfaces.API.Job import Job
dirac = Dirac()
j = Job()
j.setName("compile_mrfilter")
j.setCPUTime(80)
j.setInputSandbox(["dirac_compile_mrfilter_pilot.sh"])
j.setExecutable("dirac_compile_mrfilter_pilot.sh", "")
j.setOutputData(["mr_filter"], outputSE=None,
outputPath="cta/bin/mr_filter/v3_1/")
Dirac().submit(j)
示例11: print
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
# (you cannot overwrite it there, delete it and resubmit)
# (assumes tail and wave will always be written out together)
if '/'.join([output_path.strip('/'), output_filename_wave]) in GRID_filelist:
print("\n{} already on GRID SE\n".format(job_name))
continue
if NJobs == 0:
print("maximum number of jobs to submit reached")
print("breaking loop now")
break
else:
NJobs -= 1
j = Job()
# runtime in seconds times 8 (CPU normalisation factor)
j.setCPUTime(6 * 3600 * 8)
j.setName(job_name)
j.setInputSandbox(input_sandbox)
if banned_sites:
j.setBannedSites(banned_sites)
# j.setDestination( 'LCG.IN2P3-CC.fr' )
# mr_filter loses its executable property by uploading it to the GRID SE; reset
j.setExecutable('chmod', '+x mr_filter')
j.setExecutable('ls -lah')
for run_file in run_filelist:
file_token = re.split('_', run_file)[3]
示例12: Job
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
""" simple hello world job
"""
from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
j = Job()
j.setName( "helloWorld-test" )
j.setExecutable( "exe-script.py", "", "Executable.log" )
# <-- user settings
j.setCPUTime( 172800 )
tier1s = DMSHelpers().getTiers( tier = ( 0, 1 ) )
j.setBannedSites( tier1s )
# user settings -->
# print j.workflow
# submit the job to dirac
result = Dirac().submitJob(j)
print result
示例13: str
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
dat = input_file_base.replace('aug', 'DAT')
datlong = dat + ".long"
output_files= [run_log, 'fluka11.out', 'fluka15.err', dat, datlong ]
## prepare the output location in GRID storage; the input path will be the used also for GRID storage
outdir = grid_basedir_output + path + "/" + str(runnr)
## ALWAYS, INFO, VERBOSE, WARN, DEBUG
j.setLogLevel('debug')
j.setName('AUGER test simulation')
j.setDestinationCE(ce1)
## j.setDestination(site_dirac)
j.setCPUTime(345600) ## 4 days
## download the script for preparing corsika input file for usage with cvmfs
j.setExecutable( 'curl', arguments = ' -fsSLkO http://issaf.spacescience.ro/adrian/AUGER/make_run4cvmfs',logFile='cmd_logs.log')
j.setExecutable( 'chmod', arguments = ' +x make_run4cvmfs',logFile='cmd_logs.log')
## create the simulation script configured for use with cvmfs
## set the make_run4cvmfs arguments to include the corsika_version and corsika_bin
make_run4cvmfs_arg = input_file_base + " " + corsika_version + " " + corsika_bin
j.setExecutable( './make_run4cvmfs', arguments = make_run4cvmfs_arg, logFile='cmd_logs.log')
## run simulation
j.setExecutable( './execsim',logFile='cmd_logs.log')
j.setOutputSandbox(output_files)
j.setOutputData(output_files, outputSE=se, outputPath=outdir)
示例14: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
from DIRAC.Interfaces.API.Dirac import Dirac
#from tests.Workflow.Integration.Test_UserJobs import createJob
gLogger.setLevel( 'DEBUG' )
cwd = os.path.realpath( '.' )
dirac = Dirac()
# Simple Hello Word job to DIRAC.Jenkins.ch
gLogger.info( "\n Submitting hello world job targeting DIRAC.Jenkins.ch" )
helloJ = Job()
helloJ.setName( "helloWorld-TEST-TO-Jenkins" )
helloJ.setInputSandbox( [find_all( 'exe-script.py', '..', '/DIRAC/tests/Workflow/' )[0]] )
helloJ.setExecutable( "exe-script.py", "", "helloWorld.log" )
helloJ.setCPUTime( 17800 )
helloJ.setDestination( 'DIRAC.Jenkins.ch' )
result = dirac.submit( helloJ )
gLogger.info( "Hello world job: ", result )
if not result['OK']:
gLogger.error( "Problem submitting job", result['Message'] )
exit( 1 )
# Simple Hello Word job to DIRAC.Jenkins.ch, that needs to be matched by a MP WN
gLogger.info( "\n Submitting hello world job targeting DIRAC.Jenkins.ch and a MP WN" )
helloJMP = Job()
helloJMP.setName( "helloWorld-TEST-TO-Jenkins-MP" )
helloJMP.setInputSandbox( [find_all( 'exe-script.py', '..', '/DIRAC/tests/Workflow/' )[0]] )
helloJMP.setExecutable( "exe-script.py", "", "helloWorld.log" )
helloJMP.setCPUTime( 17800 )
helloJMP.setDestination( 'DIRAC.Jenkins.ch' )
示例15: str
# 需要导入模块: from DIRAC.Interfaces.API.Job import Job [as 别名]
# 或者: from DIRAC.Interfaces.API.Job.Job import setCPUTime [as 别名]
## PREPARE JOB ##
#####################
if (DO_NOT_SUBMIT):
sys.exit(os.EX_USAGE)
### ALWAYS, INFO, VERBOSE, WARN, DEBUG
j.setLogLevel('debug')
j.setDestination(site_dirac)
JOB_IDX = first_job + 1 + idx
JOB_NAME = PROD_NAME + " IDX_" + str(JOB_IDX)
print '\nJOB NAME is : ', JOB_NAME
j.setName(JOB_NAME)
j.setCPUTime(JOB_CPUTIME) ## 4 days
run_corsika_sim_args = input_file_base + " " + corsika_version + " " + corsika_bin
j.setExecutable( './run_corsika_sim', arguments = run_corsika_sim_args, logFile='run_sim.log')
if (TEST_JOB) :
jobID = dirac.submit(j,mode='local')
else :
jobID = dirac.submit(j)
id = str(jobID) + "\n"
print 'Submission Result: ',jobID
with open('jobids.list', 'a') as f_id_log:
f_id_log.write(id + '\n')