本文整理汇总了Python中DIRAC.Interfaces.API.Dirac.Dirac.submit方法的典型用法代码示例。如果您正苦于以下问题:Python Dirac.submit方法的具体用法?Python Dirac.submit怎么用?Python Dirac.submit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.Dirac.Dirac
的用法示例。
在下文中一共展示了Dirac.submit方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: submitProbeJobs
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [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()
示例2: runLocal
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
def runLocal( self, dirac = None ):
""" The dirac (API) object is for local submission.
"""
if dirac is None:
dirac = Dirac()
return dirac.submit( self, mode = 'local' )
示例3: do_installonsite
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [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.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [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: submit
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
def submit(self, param):
j = Job()
j.setName(param['jobName'])
j.setExecutable(param['jobScript'],logFile = param['jobScriptLog'])
if self.site:
j.setDestination(self.site)
if self.jobGroup:
j.setJobGroup(self.jobGroup)
j.setInputSandbox(param['inputSandbox'])
j.setOutputSandbox(param['outputSandbox'])
j.setOutputData(param['outputData'], outputSE = self.outputSE, outputPath = self.outputPath)
dirac = GridDirac()
result = dirac.submit(j)
status = {}
status['submit'] = result['OK']
if status['submit']:
status['job_id'] = result['Value']
return status
示例6: CEBaseTest
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
class CEBaseTest( TestBase ):
"""
CEBaseTest is base class for all the CE test classes. Real CE test should
implement its _judge method.
"""
def __init__( self, args = None, apis = None ):
super( CEBaseTest, self ).__init__( args, apis )
self.timeout = self.args.get( 'timeout', 1800 )
self.vo = self.args.get( 'VO' )
self.testType = self.args[ 'TestType' ]
self.executable = self.args[ 'executable' ]
self.__logPath = '/opt/dirac/pro/BESDIRAC/ResourceStatusSystem/SAM/log'
self.__scriptPath = '/opt/dirac/pro/BESDIRAC/ResourceStatusSystem/SAM/sam_script'
if 'WMSAdministrator' in self.apis:
self.wmsAdmin = self.apis[ 'WMSAdministrator' ]
else:
self.wmsAdmin = RPCClient( 'WorkloadManagement/WMSAdministrator' )
if 'Dirac' in self.apis:
self.dirac = self.apis[ 'Dirac' ]
else:
self.dirac = Dirac()
def doTest( self, elementDict ):
"""
submit test job to the specified ce or cloud..
"""
elementName = elementDict[ 'ElementName' ]
elementType = elementDict[ 'ElementType' ]
vos = elementDict[ 'VO' ]
site = None; ce = None
if elementType == 'ComputingElement':
ce = elementName
if elementType == 'CLOUD':
site = elementName
if self.vo:
submitVO = self.vo
elif vos:
submitVO = vos[ 0 ]
else:
submitVO = 'bes'
submissionTime = datetime.utcnow().replace( microsecond = 0 )
sendRes = self.__submit( site, ce, submitVO )
if not sendRes[ 'OK' ]:
return sendRes
jobID = sendRes[ 'Value' ]
result = { 'Result' : { 'JobID' : jobID,
'VO' : submitVO,
'SubmissionTime' : submissionTime },
'Finish' : False }
return S_OK( result )
def __submit( self, site, CE, vo ):
"""
set the job and submit.
"""
job = Job()
job.setName( self.testType )
job.setJobGroup( 'CE-Test' )
job.setExecutable( self.executable )
job.setInputSandbox( '%s/%s' % ( self.__scriptPath, self.executable ) )
if site and not CE:
job.setDestination( site )
if CE:
job.setDestinationCE( CE )
LOCK.acquire()
proxyPath = BESUtils.getProxyByVO( 'zhangxm', vo )
if not proxyPath[ 'OK' ]:
LOCK.release()
return proxyPath
proxyPath = proxyPath[ 'Value' ]
oldProxy = os.environ.get( 'X509_USER_PROXY' )
os.environ[ 'X509_USER_PROXY' ] = proxyPath
result = self.dirac.submit( job )
if oldProxy is None:
del os.environ[ 'X509_USER_PROXY' ]
else:
os.environ[ 'X509_USER_PROXY' ] = oldProxy
LOCK.release()
return result
def getTestResult( self, elementName, vo, jobID, submissionTime ):
"""
download output sandbox and judge the test status from the log file.
"""
#.........这里部分代码省略.........
示例7: dexit
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
dexit(1)
sites = result[ 'Value' ]
j.setDestination(sites)
if not opts.stagein is None:
input_stage_files = []
# we do add. input staging
files = opts.stagein.split(",")
for f in files:
if f.startswith("LFN"):
input_stage_files.append(f)
else:
input_stage_files+=extract_file(f)
for f in input_stage_files:
if not f.startswith("LFN"):
gLogger.error("*ERROR* required inputfiles to be defined through LFN, could not find LFN in %s"%f)
dexit(1)
j.setInputData(input_stage_files)
if opts.debug:
gLogger.notice('*DEBUG* just showing the JDL of the job to be submitted')
gLogger.notice(j._toJDL())
d = Dirac(True,"myRepo.rep")
res = d.submit(j)
if not res['OK']:
gLogger.error("Error during Job Submission ",res['Message'])
dexit(1)
JobID = res['Value']
gLogger.notice("Your job %s (\"%s\") has been submitted."%(str(JobID),executable))
示例8: int
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [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()
示例9: print
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
print
print("OutputData: {}{}".format(output_path, output_filename_wave))
print("OutputData: {}{}".format(output_path, output_filename_tail))
j.setOutputData([output_filename_wave, output_filename_tail],
outputSE=None, outputPath=output_path)
# check if we should somehow stop doing what we are doing
if "dry" in sys.argv:
print("\nrunning dry -- not submitting")
exit()
# this sends the job to the GRID and uploads all the
# files into the input sandbox in the process
print("\nsubmitting job")
print('Submission Result: {}\n'.format(dirac.submit(j)['Value']))
# break if this is only a test submission
if "test" in sys.argv:
print("test run -- only submitting one job")
exit()
try:
os.remove("datapipe.tar.gz")
os.remove("tino_cta.tar.gz")
except:
pass
print("\nall done -- exiting now")
exit()
示例10: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
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' )
helloJMP.setTag('MultiProcessor')
result = dirac.submit( helloJMP ) # this should make the difference!
示例11: str
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import submit [as 别名]
#####################
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')