def direct(job_id, start_date, node_name, s1=None, s2=None): sd = date_string(start_date) ed = date_string(start_date) user_name = "molu8455" print job_id print node_name print sd print ed runtest = True if s1==None and s2==None: runtest = False # Create the Job or get the job if it's already there job = Job(job_id=job_id, user_name=user_name, start_time=sd, end_time=ed, test_run=runtest) try: job.save() except IntegrityError as e: job = Job.objects.filter(job_id=job_id)[0:1].get() # Create the node test node_test = NodeTest(job=job, node_name=node_name) try: node_test.save() except IntegrityError as e: node_test = NodeTest.objects.filter(job=job, node_name=node_name)[0:1].get() print job.job_id print node_test.node_name if runtest == True: create_test(node_test,'stream',s1, 3100) create_test(node_test,'linpack',s2, 145)
def create_or_get_job(config): # Job info job_id_tmp = config.get('pbs', 'job_id') job_id = job_id_tmp.split('.')[0] user_name = config.get('pbs', 'job_user') job_name = config.get('pbs', 'job_name')[:60] start_date = config.get('script', 'date') sd = date_string(start_date) print job_id print job_name print user_name print sd testrun = True try: name = config.get('Benchmarks', 'name') except ConfigParser.NoSectionError: print "no section" testrun = False # Create the Job or get the job if it's already there job = Job(job_id=job_id, user_name=user_name, job_name=job_name, start_time=sd, test_run=testrun) try: job.save() except IntegrityError as e: job = Job.objects.filter(job_id=job_id)[0:1].get() script_type = config.get('script', 'type') print script_type if script_type == 'epilogue': resources = config.get('pbs', 'job_resources') job.resources = resources job.save() return job