def prepare(self): job = JobObject(self.si); job.setUniqueJobname("echo_job1") job.setCommandline("echo \"Hello World\"") job.createJob() self.job = job
def prepare(self): job = JobObject(self.si); job.setUniqueJobname("echo_job1") job.setCommandline("echo \"Hello World\"") job.addInputFileUrl("/home/markus/tmp/text0.txt"); job.createJob() self.job = job
def prepare(self): job = JobObject(self.si); job.setUniqueJobname("echo_job1") job.setCommandline("echo \"Hello World\"") job.addInputFileUrl("/home/markus/tmp/46mbInput0.bin"); job.setApplication(Constants.GENERIC_APPLICATION_NAME) job.setSubmissionLocation(self.subLoc) job.createJob() self.job = job
def prepare(self): job = JobObject(self.si); job.setUniqueJobname("echo_job1") job.setCommandline("echo \"Hello World\"") job.addInputFileUrl("gsiftp://ng2.canterbury.ac.nz/home/gridcloud061/tmp/text0.txt"); job.addInputFileUrl("gsiftp://ng2.canterbury.ac.nz/home/gridcloud061/tmp/text1.txt"); job.addInputFileUrl("gsiftp://ng2.canterbury.ac.nz/home/gridcloud061/tmp/text2.txt"); job.addInputFileUrl("gsiftp://ng2.canterbury.ac.nz/home/gridcloud061/tmp/text3.txt"); job.addInputFileUrl("gsiftp://ng2.canterbury.ac.nz/home/gridcloud061/tmp/text4.txt"); job.setApplication(Constants.GENERIC_APPLICATION_NAME) job.setSubmissionLocation(self.subLoc) job.createJob() self.job = job
class simpleStageJob(action): def __init__(self, si, subLoc=defaultSubLoc): super(simpleStageJob, self).__init__(si, subLoc) self.job = JobObject(self.si) self.job.setCommandline("echo \"hello world\"") self.job.setApplication(Constants.GENERIC_APPLICATION_NAME) self.job.setSubmissionLocation(self.subLoc) def prepare(self): self.job.setUniqueJobname(self.name()) self.job.createJob() def execute(self): self.job.submitJob()
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()
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() print 'Waiting for the job to finish...' # this waits until the job is finished. Checks every 10 seconds (which would be too often for a real job) finished = job.waitForJobToFinish(10) if not finished:
# 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") # the walltime for the job. Can be set individually or for the multijob (which would have to be done later) job.setWalltimeInSeconds(60) # adding the job to the multijob 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
from org.vpac.grisu.frontend.control.login import LoginManager from org.vpac.grisu.frontend.model.job import JobObject si = LoginManager.loginCommandline("BeSTGRID") job = JobObject(si); job.setUniqueJobname("cat_job") job.setCommandline("cat singleJobFile_0.txt") job.addInputFileUrl('/home/markus/test/singleJobFile_0.txt'); job.createJob("/ARCS/BeSTGRID") job.submitJob() job.waitForJobToFinish(10) print 'Job finished. Status: '+job.getStatusString(False) print "Stdout: " + job.getStdOutContent() print "Stderr: " + job.getStdErrContent() job.kill(True)
''' from org.vpac.grisu.frontend.control.login import LoginManager from org.vpac.grisu.frontend.model.job import JobObject import sys si = LoginManager.loginCommandline("ARCS") # create the job object job = JobObject(si); # set a unique jobname job.setUniqueJobname("echo_job1") # set the commandline that needs to be executed job.setCommandline("echo \"Hello World\"") # create the job on the backend and specify the VO to use job.createJob("/ACC") # submit the job job.submitJob() # this waits until the job is finished. Checks every 10 seconds (which would be too often for a real job) finished = job.waitForJobToFinish(10) if not finished: print "not finished yet." # kill the job on the backend anyway job.kill(True); else: # download and cache the jobs' stdout and display it's content
from org.vpac.grisu.frontend.control.login import LoginManager from org.vpac.grisu.frontend.model.job import JobObject from org.vpac.grisu.model import GrisuRegistryManager si = LoginManager.loginCommandline("LOCAL") appInfo = GrisuRegistryManager.getDefault(si).getApplicationInformation("ImageJ") print 'app: '+appInfo.getApplicationName() for subloc in appInfo.getAvailableAllSubmissionLocations(): print subloc job = JobObject(si); job.setTimestampJobname("imageJ"); job.setApplication("java"); job.setApplication("ImageJ"); job.setCommandline("echo Hello"); job.setSubmissionLocation("normal:ng2.ivec.org"); job.createJob("/ARCS/StartUp"); job.submitJob(); job.waitForJobToFinish(3); print "Stdout: "+job.getStdOutContent() print "Stderr: "+job.getStdErrContent()