multiPartJob.addJob(job) multiPartJob.setDefaultNoCpus(1); multiPartJob.setDefaultWalltimeInSeconds(60); # now we add an input file that is common to all jobs #multiPartJob.addInputFile("/home/markus/sample input files/JavaTestJob.jar"); # we don't want to submit to tpac because it doesn't work #multiPartJob.setSitesToExclude(["uq", "hpsc", "auckland", "canterbury"]); try: print "Creating jobs on the backend and staging files..." multiPartJob.prepareAndCreateJobs(True) except (JobsException), error: for job in error.getFailures().keySet(): print "Job: "+job.getJobname()+", Error: "+error.getFailures().get(job).getLocalizedMessage() sys.exit() print "Job distribution:" for subLoc in multiPartJob.getOptimizationResult().keySet(): print subLoc + " : " +multiPartJob.getOptimizationResult().get(subLoc) print "Submitting jobs..." multiPartJob.submit() restarted = False # now we wait for all jobs to finish. Actually, we probably should test whether the job was successful as well... while not multiPartJob.isFinished(True):
si = LoginManager.loginCommandline() print 'Parsing commandline arguments...' file1url = sys.argv[1] file1Name = FileManager.getFilename(file1url) file2url = sys.argv[2] file2Name = FileManager.getFilename(file2url); print 'Creating job...' # create the job object job = JobObject(si); # set a unique jobname job.setTimestampJobname("diff_job") print 'Set jobname to: '+ job.getJobname() # setting the application. this means that grisu can figure out the submission location and # you don't have to do that manually job.setApplication("UnixCommands") # set the commandline that needs to be executed job.setCommandline('diff ' + file1Name+ ' ' + file2Name) job.addInputFileUrl(file1url); job.addInputFileUrl(file2url); # create the job on the backend and specify the VO to use job.createJob("/ARCS/StartUp") print 'Submitting job...' # submit the job job.submitJob()
batchJob.setDefaultNoCpus(1); batchJob.setDefaultWalltimeInSeconds(60); # now we add an input file that is common to all jobs batchJob.addInputFile(inputFile1Url); batchJob.addInputFile(inputFile2Url); batchJob.addInputFile(inputFile3Url); # we don't want to submit to tpac because it doesn't work #multiPartJob.setSitesToExclude(["uq", "hpsc", "auckland", "canterbury"]); try: print "Creating jobs on the backend and staging files..." batchJob.prepareAndCreateJobs(True) except (JobsException), error: for job in error.getFailures().keySet(): print "Job: "+job.getJobname()+", Error: "+error.getFailures().get(job).getLocalizedMessage() sys.exit() # this is not really needed print "Job distribution:" for subLoc in batchJob.getOptimizationResult().keySet(): print subLoc + " : " +batchJob.getOptimizationResult().get(subLoc) print "Submitting jobs..." batchJob.submit(True) print 'Submission finished.' print 'Name of submitted batchjob: '+batchJobName