def parallel_submit(utils, title): fails=0 names,ces=utils.get_target_ces() if len(names)==0: names=["Submit to LCG-CE","Submit to CREAM CE","Submit without restrictions"] ces=["2119/jobmanager","/cream-",""] for i in range(len(names)): utils.show_progress("%s - %s"%(title,names[i])) utils.info("%s - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) result=Job_utils.submit_mpi_job(utils,ces[i]) if result[0] == 1 : utils.info(result[1]) fails=fails+1 else: utils.dbg("Clean job output directory") os.system("rm -rf %s"%(utils.get_job_output_dir())) return fails
def forward_parameters_parallel_jobs(utils, title): fails=0 names,ces=utils.get_target_ces() if len(names)==0: names=["Submit to CREAM CE"] ces=["/cream-"] for i in range(len(names)): try: utils.show_progress("%s Case 1 - %s"%(title,names[i])) utils.info("\t%s Case 1 - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) utils.change_jdl_attribute("CpuNumber","2") utils.add_jdl_general_attribute("WholeNodes","true") utils.add_jdl_general_attribute("SMPGranularity","2") utils.add_jdl_general_attribute("Hostnumber","1") check=['CpuNumber = 2','WholeNodes = true','SMPGranularity = 2','Hostnumber = 1'] errors=[] utils.info("Submit MPI job") JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file())) utils.info("Job submitted successfuly. Returned JOBID: %s"%(JOBID)) utils.info("Wait until job transefered to CE") utils.wait_until_job_transfered(JOBID) cream_jobid=utils.get_cream_jobid(JOBID) utils.info("Get the resulting cream jdl") cream_jdl=utils.get_cream_jdl(cream_jobid) utils.info("Check the cream jdl for the forwarding parameters") for attribute in check: if cream_jdl.find(attribute)==-1: errors.append(attribute) if len(errors)>0: msg=' , '.join(errors) utils.error("Problem with the following parameters: %s"%(msg)) fails=fails+1 utils.show_progress("%s Case 2 - %s"%(title,names[i])) utils.info("\t%s Case 2 - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) utils.change_jdl_attribute("CpuNumber","1") utils.add_jdl_general_attribute("WholeNodes","true") utils.add_jdl_general_attribute("SMPGranularity","2") check=['CpuNumber = 1','WholeNodes = true','SMPGranularity = 2'] errors=[] utils.info("Submit MPI job") JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file())) utils.info("Job submitted successfuly. Returned JOBID: %s"%(JOBID)) utils.info("Wait until job transefered to CREAM CE") utils.wait_until_job_transfered(JOBID) cream_jobid=utils.get_cream_jobid(JOBID) utils.info("Get the resulting cream jdl") cream_jdl=utils.get_cream_jdl(cream_jobid) utils.info("Check the cream jdl for the forwarding parameters") for attribute in check: if cream_jdl.find(attribute)==-1: errors.append(attribute) if len(errors)>0: msg=' , '.join(errors) utils.error("Problem with the following parameters: %s"%(msg)) fails=fails+1 utils.show_progress("%s Case 3 - %s"%(title,names[i])) utils.info("\t%s Case 3 - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) utils.change_jdl_attribute("CpuNumber","3") utils.add_jdl_general_attribute("WholeNodes","false") utils.add_jdl_general_attribute("SMPGranularity","3") utils.add_jdl_general_attribute("Hostnumber","1") utils.info("Submit MPI job") message=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file()),1) utils.info("Check the error message") if message.find("SMPGranularity and HostNumber are mutually exclusive when WholeNodes allocation is not requested: wrong combination of values")==-1: utils.error("Job failed reason: %s. Expected reason: SMPGranularity and HostNumber are mutually exclusive when WholeNodes allocation is not requested: wrong combination of values"%(message)) fails=fails+1 utils.show_progress("%s Case 4 - %s"%(title,names[i])) utils.info("\t%s Case 4 - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) utils.change_jdl_attribute("CpuNumber","3") utils.add_jdl_general_attribute("WholeNodes","false") utils.add_jdl_general_attribute("SMPGranularity","3") check=['CpuNumber = 3','WholeNodes = false','SMPGranularity = 3'] errors=[] utils.info("Submit MPI job") JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file())) utils.info("Job submitted successfuly. Returned JOBID: %s"%(JOBID)) utils.info("Wait until job transefered to CREAM CE") utils.wait_until_job_transfered(JOBID) cream_jobid=utils.get_cream_jobid(JOBID) utils.info("Get the resulting cream jdl") cream_jdl=utils.get_cream_jdl(cream_jobid) utils.info("Check the cream jdl for the forwarding parameters") for attribute in check: if cream_jdl.find(attribute)==-1: errors.append(attribute) if len(errors)>0: msg=' , '.join(errors) utils.error("Problem with the following parameters: %s"%(msg)) fails=fails+1 utils.show_progress("%s Case 5 - %s"%(title,names[i])) utils.info("\t%s Case 5 - %s"%(title,names[i])) Job_utils.prepare_mpi_job(utils,utils.get_jdl_file(),ces[i]) utils.change_jdl_attribute("CpuNumber","8") utils.add_jdl_general_attribute("WholeNodes","true") utils.add_jdl_general_attribute("SMPGranularity","8") utils.add_jdl_general_attribute("Hostnumber","2") check=['CpuNumber = 8','WholeNodes = true','SMPGranularity = 8','Hostnumber = 2'] errors=[] utils.info("Submit MPI job") JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file())) utils.info("Job submitted successfuly. Returned JOBID: %s"%(JOBID)) utils.info("Wait until job transefered to CREAM CE") utils.wait_until_job_transfered(JOBID) cream_jobid=utils.get_cream_jobid(JOBID) utils.info("Get the resulting cream jdl") cream_jdl=utils.get_cream_jdl(cream_jobid) utils.info("Check the cream jdl for the forwarding parameters") for attribute in check: if cream_jdl.find(attribute)==-1: errors.append(attribute) if len(errors)>0: msg=' , '.join(errors) utils.error("Problem with the following parameters: %s"%(msg)) fails=fails+1 except (GeneralError,RunCommandError) , e : utils.log_error("%s"%(utils.get_current_test())) utils.log_error("Command: %s"%(e.expression)) utils.log_error("Message: %s"%(e.message)) utils.log_traceback("%s"%(utils.get_current_test())) utils.log_traceback(traceback.format_exc()) fails=fails+1