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') if i == 3 or i == 13: # this is just to demonstrate how to restart a failed job later on job.setCommandline('cat ' + inputFile3relPath) else: job.setCommandline('cat ' + inputFile1relPath + ' ' + inputFile2relPath) job.setWalltimeInSeconds(60) # adding the job to the multijob batchJob.addJob(job) # this should be set because it's used for the matchmaking/metascheduling 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:
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) job.setWalltimeInSeconds(60) # adding the job to the multijob batchJob.addJob(job) # only start the newly added jobs and wait for the restart to finish batchJob.restart(False, False, True, True) # don't forget to exit properly. this cleans up possible existing threads/executors sys.exit()
""" if group == '': group = DEFAULT_GROUP if queue == '': queue = DEFAULT_QUEUE for f in sys.argv[8:]: input_files.append(f) try: job = JobObject(si) job.setSubmissionLocation(queue) job.setTimestampJobname("galaxy_" + galaxy_job_id) job.setMemory(DEFAULT_MEMORY) job.setWalltimeInSeconds(DEFAULT_WALLTIME) # stop annoying stats from being written to stderr job.addEnvironmentVariable("SUPPRESS_STATS", "true") #create the job script# except: print "Cannot setup the job environment" sys.exit(-4) #create nesi job_script try: # save jobname for job njn = open(jobname_file, "w") njn.write(job.getJobname())