コード例 #1
0
def normal_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_normal_job(utils,utils.get_jdl_file(),ces[i])

        result=Job_utils.submit_normal_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
コード例 #2
0
def test3(utils,title):

    names,ces=utils.get_target_ces()

    fails=0

    if len(names)==0:
        names.append("Default Test")
        ces.append("")

    for i in range(len(names)):

        utils.show_progress("%s - %s"%(title,names[i]))

        utils.info("%s - %s"%(title,names[i]))

        try:

            ###Create jdl with ShortDeadlineJob attribute enabled
            utils.set_isb_jdl(utils.get_jdl_file())
            utils.add_jdl_general_attribute("RetryCount",1)
            utils.add_jdl_general_attribute("ShortDeadlineJob","true")

            if len(ces[i])>0:
                 utils.set_requirements("%s && %s"%(ces[i],utils.DEFAULTREQ))
            else:
                 utils.set_requirements("%s"%utils.DEFAULTREQ)

            output=utils.run_command_continue_on_error("glite-wms-job-list-match %s -c %s %s"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_jdl_file()))

            if output.find("No Computing Element matching your job requirements has been found!")!=-1:

                utils.error("No Computing Element matching your job requirements has been found!")
                raise GeneralError("","No Computing Element matching your job requirements has been found!")

            else:

                result=Job_utils.submit_normal_job(utils,"")

                if result[0] == 1 :
                    utils.error(result[1])
                    raise GeneralError("Job Submission",result[1])
                else:
                    utils.dbg("Clean job output directory")
                    os.system("rm -rf %s"%(utils.get_job_output_dir()))

            
        except (RunCommandError,GeneralError,TimeOutError) , 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
コード例 #3
0
def main():
    	
    utils = Test_utils.Test_utils(sys.argv[0],"Test a complete job cycle: from submission to get output")

    tests=["Set 1: Submit a normal job"]
    tests.append("Set 2: Submit a bulk of jobs")
    tests.append("Set 3: Submit a parametric job")
    tests.append("Set 4: Submit a DAG job")
    tests.append("Set 5: Submit a MPI job")
    tests.append("Set 6: Submit a perusal job")
    tests.append("Set 7: Submit a bulk of jobs using a single jdl with al the jdls of nodes")
    tests.append("Set 8: Testing forwarding parameters for parallel jobs")
    

    utils.prepare(sys.argv[1:],tests)

    utils.info("Test a complete job cycle: from submission to get output")

    signal.signal(signal.SIGINT,utils.exit_interrupt)

    fails=[]

    # This test is for direct submission to a given CE
    if utils.get_user_CE() !='' :
    
        utils.info ("Submit a normal job to %s"%(utils.get_user_CE()))

        Job_utils.prepare_normal_job(utils,utils.get_jdl_file(),utils.get_user_CE())
        
        result=Job_utils.submit_normal_job(utils,utils.get_user_CE())

        if result[0] == 1 :
            utils.warn(result[1])
            utils.log_error("Submit a normal job to %s"%(utils.get_user_CE()))
            utils.log_error(result[1])
            utils.exit_failure(result[1])

        utils.message("Clean job output directory")
        os.system("rm -rf %s"%(utils.get_job_output_dir()))
	
    else:
        
        all_tests=utils.is_all_enabled()

        if all_tests==1 or utils.check_test_enabled(1)==1 :
            if normal_submit(utils, tests[0]):
                fails.append(tests[0])
                
        if all_tests==1 or utils.check_test_enabled(2)==1 :
            if bulk_submit(utils, tests[1]):
               fails.append(tests[1])
        
        if all_tests==1 or utils.check_test_enabled(3)==1 :
            if parametric_submit(utils, tests[2]):
                fails.append(tests[2])
                
        if all_tests==1 or utils.check_test_enabled(4)==1 :
            if dag_submit(utils, tests[3]):
                fails.append(tests[3])
            
        if all_tests==1 or utils.check_test_enabled(5)==1 :
            if parallel_submit(utils, tests[4]):
                fails.append(tests[4])
                
        if all_tests==1 or utils.check_test_enabled(6)==1 :
            if perusal_submit(utils, tests[5]):
                fails.append(tests[5])

        if all_tests==1 or utils.check_test_enabled(7)==1 :
            if bulk_submit_with_single_jdl(utils, tests[6]):
                fails.append(tests[6])

        if all_tests==1 or utils.check_test_enabled(8)==1 :
            if forward_parameters_parallel_jobs(utils, tests[7]):
                fails.append(tests[7])



    if len(fails) > 0 :
      utils.exit_failure("%s test(s) fail(s): %s"%(len(fails), fails))
    else:
      utils.exit_success()