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): 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
files_to_upload.append(line) else: print 'Not a file: ' + line sys.exit(1) return files_to_upload files_to_upload = read_files(files_file) if not si: LoginManager.initEnvironment() si = LoginManager.login('bestgrid', True) filemanager = GrisuRegistryManager.getDefault(si).getFileManager() job = JobObject(si) job.setSubmissionLocation('pan:pan.nesi.org.nz') job.setTimestampJobname(jobname_template) job.setCommandline(commandline) # add input files for file in files_to_upload: job.addInputFileUrl(file) jobname = job.createJob('/nz/nesi') print 'Submitting job...' job.submitJob() print 'Jobname: ' + jobname print 'Waiting for job to finish...' job.waitForJobToFinish(jobstate_check_intervall)
si = LoginManager.loginCommandline('bestgrid') uem = GrisuRegistryManager.getDefault(si).getUserEnvironmentManager() fm = GrisuRegistryManager.getDefault(si).getFileManager() allJobs = uem.getCurrentJobs(False) myJobs = [] finishedJobs = [] # getting all the jobs for the run we are interested in for job in allJobs: name = job.jobname() if name.startswith('staging_test'): tempJob = JobObject(si, name) myJobs.append(tempJob) fileUrls = [] # we could just wait for all the jobs, but looping makes more sense # since we can stage out finished jobs while some other jobs of the batch # are still running while len(myJobs) > 0: for job in myJobs: if job.isFinished(): if job.isFailed(False): print 'Job '+job.getJobname()+' failed. Not doing anything...' myJobs.remove(job)
from grisu.frontend.control.login import LoginManager from grisu.frontend.model.job import JobObject import sys # create a service interface to the BeSTGRID backend service_interface = LoginManager.loginCommandline("BeSTGRID") print 'Creating job object...' job = JobObject(service_interface) job.setJobname("echo_job-1") # job name must be unique print 'Set jobname to: ' + job.getJobname() # set the name of the application as it is published in MDS. # "generic" means not to use MDS for the lookup. job.setApplication("generic") # "generic" jobs require a submission location to be specified job.setSubmissionLocation("all.q:ng2.scenzgrid.org#SGE") # set the command that needs to be executed job.setCommandline("echo \"Hello World\"") # create the job on the backend and specify the VO to use job.createJob("/ARCS/BeSTGRID") 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)
# Setting the number of jobs to be submitted job_count = 5 # Since there may be many jobs submitted in the workshop, lets make them a bit unique to avoid issues. base_job_name = str(random.randint(10000, 99999)) + '-hello-' print "INFO: Base job name is " + base_job_name # There are three stages, creating the jobs, submitting the jobs, then after they have finished, retrieving the job outputs # Creating a list of jobs jobs = [] print "INFO: Defining " + str(job_count) + " helloworld jobs" for i in range(1, job_count + 1): print "INFO: Defining job " + str(i) + " of " + str(job_count) #The next lines define the actual job's parameters job = JobObject(service_interface) # Create a job job.setJobname(base_job_name + str(i)) # Give it a (hopefully) unique name job.setApplication("python") # Set the application being run job.setApplicationVersion( "2.4") # Set the application version, note this is an exact match # job.setSubmissionLocation("all.q:ng2.scenzgrid.org#SGE") # Set the location the job will be submitted to job.addInputFileUrl(os.path.join(current_dir, "helloworld.py")) # Add a file job.setCommandline("python helloworld.py") # Set the command to be run print "INFO: job " + job.getJobname() + " defined" jobs.append(job) # Submit the jobs to be run # Note the exception catching to give more information about a job failing for job in jobs: time_start = time.time()