inputdir = '/home/markus/Desktop/R/' #inputfilename = 'Evaluation_Markov-ADF-Test-2011-05-09-mc50.r' inputfilename = 'Evaluation_Markov-ADF-Test-2011-05-09-mc50-test.r' print 'logging in...' si = LoginManager.loginCommandline(backend) print 'starting job creation...' group = '/nz/nesi' #sub_loc = '[email protected]:ng2.auckland.ac.nz' batch_job = BatchJobObject(si, basename, group, 'R', Constants.NO_VERSION_INDICATOR_STRING) batch_job_name = batch_job.getJobname() print 'jobname on backend: '+batch_job_name path_to_inputfile = batch_job.pathToInputFiles()+inputfilename for i in range(1,gen_jobs+1): job = JobObject(si) job.setEmail_address(email) job.setEmail_on_job_finish(True) job.setCommandline('R --no-readline --no-restore --no-save -f '+path_to_inputfile) batch_job.addJob(job) batch_job.addInputFile('/home/markus/Desktop/R/'+inputfilename) batch_job.setDefaultNoCpus(1)
print "Job: " + job.getJobname() + ", Error: " + error.getFailures( ).get(job).getLocalizedMessage() sys.exit() print "Job distribution:" print batch_job.getOptimizationResult() print "Submitting jobs..." batch_job.submit() # now we wait for all jobs to be finished, checking for updates every 10 seconds. in real life we would set a much higher check intervall since we don't want to overload # the backend and also it's not really necessary batch_job.waitForJobToFinish(10) print "BatchJob " + batch_job.getJobname() + " finished." # finally, everything is ready. We could do a lot more here, but you get the idea... for job in batch_job.getJobs(): print "Job: " + job.getJobname() + ", Status: " + job.getStatusString( False) print "Submitted to: " + job.getJobProperty(Constants.SUBMISSION_SITE_KEY) print print "Stdout: " print job.getStdOutContent() print print "Stderr: " print job.getStdErrContent() print print
batch_jobs.addInputFile(os.path.join(current_dir, "countbacon.py")) print "INFO: Defining jobs from input directory" job_count = 0 for file_name in os.listdir(input_path): print "INFO: Defining job for " + file_name job_name = base_job_name + "-" + file_name job = JobObject(service_interface) job.setJobname(job_name) job.setApplication("python") # Set the application being run job.setApplicationVersion("2.4") # Set the application version, note this is an exact match job.addInputFileUrl(os.path.join(current_dir, input_path, file_name)) job.setCommandline("python ../countbacon.py ../" + dictionary_path + " " + file_name) print "INFO: " + job.getJobname() + " defined" batch_jobs.addJob(job) print "INFO: " + job.getJobname() + " added to batch " + batch_jobs.getJobname() job_count += 1 print "INFO: " + str(job_count) + " jobs defined" print "INFO: Sending batch " + batch_jobs.getJobname() + " to " + backend + " and staging files..." try: batch_jobs.prepareAndCreateJobs(False) except (JobsException), error: print ("HALT: Exception submitting jobs from BatchJobObject " + batch_jobs.getJobname() + "!") for job in error.getFailures().keySet(): print "Job: " + job.getJobname() + ", Error: " + error.getFailures().get(job).getLocalizedMessage() sys.exit(1) except (BackendException), error: print ("HALT: Exception from grisu backend " + backend + "!") print (error.getLocalizedMessage()) print ("========================")
sys.exit() print "Job distribution:" print batch_job.getOptimizationResult() print "Submitting jobs..." batch_job.submit() # now we wait for all jobs to be finished, checking for updates every 10 seconds. in real life we would set a much higher check intervall since we don't want to overload # the backend and also it's not really necessary batch_job.waitForJobToFinish(10) print "BatchJob "+batch_job.getJobname()+" finished." # finally, everything is ready. We could do a lot more here, but you get the idea... for job in batch_job.getJobs(): print "Job: "+job.getJobname()+", Status: "+job.getStatusString(False) print "Submitted to: "+job.getJobProperty(Constants.SUBMISSION_SITE_KEY) print print "Stdout: " print job.getStdOutContent() print print "Stderr: " print job.getStdErrContent() print print print "Finished."
#inputfilename = 'Evaluation_Markov-ADF-Test-2011-05-09-mc50.r' inputfilename = 'Evaluation_Markov-ADF-Test-2011-05-09-mc50-test.r' print 'logging in...' si = LoginManager.loginCommandline(backend) print 'starting job creation...' group = '/nz/nesi' #sub_loc = '[email protected]:ng2.auckland.ac.nz' batch_job = BatchJobObject(si, basename, group, 'R', Constants.NO_VERSION_INDICATOR_STRING) batch_job_name = batch_job.getJobname() print 'jobname on backend: ' + batch_job_name path_to_inputfile = batch_job.pathToInputFiles() + inputfilename for i in range(1, gen_jobs + 1): job = JobObject(si) job.setEmail_address(email) job.setEmail_on_job_finish(True) job.setCommandline('R --no-readline --no-restore --no-save -f ' + path_to_inputfile) batch_job.addJob(job) batch_job.addInputFile('/home/markus/Desktop/R/' + inputfilename)
job_count = 0 for file_name in os.listdir(input_path): print "INFO: Defining job for " + file_name job_name = base_job_name + "-" + file_name job = JobObject(service_interface) job.setJobname(job_name) job.setApplication("python") # Set the application being run job.setApplicationVersion( "2.4") # Set the application version, note this is an exact match job.addInputFileUrl(os.path.join(current_dir, input_path, file_name)) job.setCommandline("python ../countbacon.py ../" + dictionary_path + " " + file_name) print "INFO: " + job.getJobname() + " defined" batch_jobs.addJob(job) print "INFO: " + job.getJobname( ) + " added to batch " + batch_jobs.getJobname() job_count += 1 print "INFO: " + str(job_count) + " jobs defined" print "INFO: Sending batch " + batch_jobs.getJobname( ) + " to " + backend + " and staging files..." try: batch_jobs.prepareAndCreateJobs(False) except (JobsException), error: print("HALT: Exception submitting jobs from BatchJobObject " + batch_jobs.getJobname() + "!") for job in error.getFailures().keySet(): print "Job: " + job.getJobname() + ", Error: " + error.getFailures( ).get(job).getLocalizedMessage() sys.exit(1) except (BackendException), error: