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)
# 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) #job.setSubmissionLocation("") 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("java") job.setCommandline("java -version") # setting the commandline. In this example we reference to both types of possible input files #job.setCommandline("java -jar "+pathToInputFiles+"/JavaTestJob.jar 30 1") # adding a job-specific input file #job.addInputFileUrl("/home/markus/test/singleJobFile.txt")