Exemplo n.º 1
0
from org.vpac.grisu.frontend.control.login import LoginManager
from org.vpac.grisu.frontend.model.job import BatchJobObject, JobObject
import sys

batchJobName  =  sys.argv[1]

# display commandline login menu if no local proxy exists
si = LoginManager.loginCommandline()

batchJob = BatchJobObject(si, batchJobName, False)

start = 30
end = 40

pathToInputFiles = batchJob.pathToInputFiles()

inputFile1relPath = pathToInputFiles+'inputFile1.txt ' 
inputFile2relPath = pathToInputFiles+'inputFile2.txt' 

for i in range(start, end):
    # create a unique jobname for every job
    jobname = batchJobName+"_"+ str(i)
    
    print 'Creating job: '+jobname
    
    # create the single job
    job = JobObject(si)
    job.setJobname(jobname)
    # better to set the application to use explicitely because in that case we don't need to use mds (faster)
    job.setApplication('UnixCommands')
    job.setCommandline('cat '+ inputFile1relPath + ' ' + inputFile2relPath)
Exemplo n.º 2
0
import sys
import time

# display commandline login menu if no local proxy exists
si = LoginManager.loginCommandline()

# how many jobs do we want
numberOfJobs = 20

# the (unique) name of the multijob
batchJobName = JobnameHelpers.calculateTimestampedJobname('exampleBatchJob')
  

print 'Creating batchjob '+batchJobName
# create the multipart job 
batchJob = BatchJobObject(si, batchJobName, '/ARCS/NGAdmin', 'UnixCommands', Constants.NO_VERSION_INDICATOR_STRING);

# now we can calculate the relative path (from every job directory) to the common input file folder
pathToInputFiles = batchJob.pathToInputFiles()

inputFile1Url = '/home/markus/test/inputFile1.txt'
inputFile1relPath = pathToInputFiles+'inputFile1.txt ' 

inputFile2Url = 'gsiftp://ng2.vpac.org/home/grid-vpac/DC_au_DC_org_DC_arcs_DC_slcs_O_VPAC_CN_Markus_Binsteiner_qTrDzHY7L1aKo3WSy8623-7bjgM/inputFile2.txt'
inputFile2relPath = pathToInputFiles+'inputFile2.txt' 

inputFile3Url = '/home/markus/test/errorFile.txt'
inputFile3relPath = pathToInputFiles + 'errorFile.txt'

for i in range(0, numberOfJobs):
    # create a unique jobname for every job
Exemplo n.º 3
0
    
    status = si.getActionStatus(multiJobName)
    while not status.isFinished():
        percentage = status.getCurrentElements() * 100 / status.getTotalElements()
        print "Deletion "+str(percentage)+"% finished."
        time.sleep(3)

except:
    print "No need to kill and clean job " + multiJobName
    

# to see whats going on we add a simple event listener. Hm. This doesn't seem to work reliably in jython. 
#SystemOutMultiJobLogger(multiJobName)

# create the multipart job 
multiPartJob = BatchJobObject(si, multiJobName, "/ARCS/NGAdmin", "java", Constants.NO_VERSION_INDICATOR_STRING);

# if you want to display a gui element to control/monitor the job, use the following line
BatchJobDialog.open(si, multiJobName)

# not needed anymore. it's the default now
multiPartJob.addJobProperty(Constants.DISTRIBUTION_METHOD, Constants.DISTRIBUTION_METHOD_EQUAL);

# now we can calculate the relative path (from every job directory) to the common input file folder
pathToInputFiles = multiPartJob.pathToInputFiles()

for i in range(0, numberOfJobs):
    # create a unique jobname for every job
    jobname = multiJobName+"_"+ str(i)
    # create the single job
    job = JobObject(si)
Exemplo n.º 4
0
from org.vpac.grisu.control import DefaultResubmitPolicy
from org.vpac.grisu.frontend.control.login import LoginManager
from org.vpac.grisu.frontend.model.job import BatchJobObject
from org.vpac.grisu.frontend.model.job import JobException
import sys
import time

batchJobname  =  sys.argv[1]

si = LoginManager.loginCommandline()

# load (but not refresh yet) batchjob, this might take a while
batchJob = BatchJobObject(si, batchJobname, False)

while not batchJob.isFinished(True) and False:
    
    print batchJob.getProgress()
    
    print str(batchJob.getNumberOfFailedJobs())
    
    if batchJob.getNumberOfFailedJobs() > 0:
        
        print str(batchJob.getNumberOfFailedJobs()) + ' failed jobs found. restarting...'
        failedpolicy = DefaultResubmitPolicy()
        batchJob.restart(failedpolicy, True)
        print 'Restart finished.'
        
    time.sleep(5)

jobsToRestart = []