Beispiel #1
0
def run(utils):

    bug='28642'

    logging.info("Start regression test for bug %s"%(bug))
    
    logging.info("Submit the job and wait to finish")

    utils.use_external_jdl("%s.jdl"%(bug))

    JOBID=Job_utils.submit_wait_finish(utils,"")

    Job_utils.output_normal_job(utils,JOBID)

    #Check job output
    logging.info("Check if the output files are correctly retrieved")

    if os.path.isfile("%s/input1.txt"%(utils.get_job_output_dir())) & os.path.isfile("%s/env.out"%(utils.get_job_output_dir())) & os.path.isfile("%s/env.err"%(utils.get_job_output_dir())) :
          logging.info("Output files are collectly retrieved")
    else:
          logging.error("Output files are not correctly retrieved")
          raise GeneralError("","Output files are not correctly retrieved")

    #Check the content of env.out file
    logging.info("Check the content of the env.out file")

    result=utils.run_command_continue_on_error("cat %s/env.out"%(utils.get_job_output_dir()))

    if result.find("LD_LIBRARY_PATH=.") != -1 :
        logging.info("Environment variable LD_LIBRARY_PATH has value '.' as expected")
    else:
      logging.error("Error value of environment variable LD_LIBRARY_PATH")
      raise GeneralError("","Error !!! Error value of environment variable LD_LIBRARY_PATH")
       
    logging.info("End of regression test for bug %s",bug)
Beispiel #2
0
def run(utils):

    bug='38359'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to WMS. You have to set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file")

    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("Set MaxOutputSandoxSize=100; to glite_wms.conf at WMS")

    logging.info("Set MaxOutputSandboxSize=100; to glite_wms.conf at WMS")

    utils.change_remote_file(ssh,"/etc/glite-wms/glite_wms.conf", ['MaxOutputSandboxSize'],['*'],['100'])

    logging.info("Restart Workload Manager glite-wms-wm")
    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")

    logging.info("Submit the job and wait to finish")

    utils.use_external_jdl("%s.jdl"%(bug))

    JOBID=Job_utils.submit_wait_finish(utils,"")

    logging.info("Get job output")

    Job_utils.output_normal_job(utils,JOBID)

    #Check job output
    logging.info("Check if the output files are correctly retrieved")

    if os.path.isfile("%s/test.err"%(utils.get_job_output_dir())) & os.path.isfile("%s/test.out"%(utils.get_job_output_dir())) & os.path.isfile("%s/out1"%(utils.get_job_output_dir())) & os.path.isfile("%s/out2.tail"%(utils.get_job_output_dir())) & os.path.isfile("%s/out3"%(utils.get_job_output_dir())) & os.path.isfile("%s/out4.tail"%(utils.get_job_output_dir())) :
          logging.info("Output files are collectly retrieved")
    else:
          logging.error("Output files are not correctly retrieved")
          utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
          utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
          ssh.close()
          raise GeneralError("","Output files are not correctly retrieved")

    #Check the content of env.out file
    logging.info("Check output files size")

    if int(os.path.getsize("%s/out1"%(utils.get_job_output_dir()))) != 50 or int(os.path.getsize("%s/out3"%(utils.get_job_output_dir()))) !=50 or int(os.path.getsize("%s/out2.tail"%(utils.get_job_output_dir())))!=0 or int(os.path.getsize("%s/out4.tail"%(utils.get_job_output_dir())))!=0 or int(os.path.getsize("%s/test.out"%(utils.get_job_output_dir())))!=0 or int(os.path.getsize("%s/test.err"%(utils.get_job_output_dir())))!=0 :
          logging.error("Output files do not have the expected sizes.")
          utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
          utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
          ssh.close()
          raise GeneralError("","Output files do not have the expected sizes")
   
    logging.info("Restore the initial glite_wms.conf file")

    utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
   
    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
    
    ssh.close()
    
    logging.info("End of regression test for bug %s"%(bug))
Beispiel #3
0
def run(utils):

    bug='36536'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to LBProxy DATABASE. You have to set USERNAME and PASSWORD attributes at configuration file")

    if utils.WMS_USERNAME=='' or utils.WMS_PASSWORD=='' or utils.USERNAME=='' or utils.PASSWORD=='' :
        logging.error("Missing required variables (WMS_USERNAME,WMS_PASSWORD,USERNAME,PASSWORD) from configuration file")
        raise GeneralError("Missing required variables","To verify this bug it is necessary to set WMS_USERNAME,WMS_PASSWORD,USERNAME and PASSWORD in the configuration file")


    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("Prepare and submit a simple job")

    utils.use_utils_jdl()
    utils.set_jdl(utils.get_jdl_file())

    JOBID=Job_utils.submit_wait_finish(utils,"")
    
    logging.info("Create SQL script file")

    utils.execute_remote_cmd(ssh,"echo \"SELECT * FROM jobs WHERE dg_jobid like '%%%s%%';\" > /root/test.sql"%(JOBID))

    logging.info("Retrieve the job record from LBProxy database")

    mysql_cmd="mysql -u %s --password=%s lbserver20 < /root/test.sql"%(utils.USERNAME,utils.PASSWORD)

    output=utils.execute_remote_cmd(ssh,mysql_cmd)

    if output.find(JOBID)==-1:
        logging.error("Unable to retrieve the job record from LBProxy datasse for job id:%s"%(JOBID))
        raise GeneralError("Retrieve job record from LBProxy database","Unable to retrieve the job record from LBProxy datasse for job id:%s"%(JOBID))

    logging.info("Get job output")

    Job_utils.output_normal_job(utils,JOBID)

    #Check LBProxy
    logging.info("Check again the job record in LBProxy database")

    output=utils.execute_remote_cmd(ssh,mysql_cmd)

    if output.find(JOBID)!=-1:
        logging.error("Job's record in LBProxy database has not been removed.")
        raise GeneralError("","Job's record in LBProxy database has not been removed.")
    
    logging.info("End of regression test for bug %s"%(bug))
Beispiel #4
0
def test_logic(utils,dest_CE):

       JOBID=Job_utils.submit_wait_finish(utils,"")

       #Check for job status
       logging.info("Check job stauts")

       utils.job_status(JOBID)

       if utils.get_job_status()=="Aborted":
          logging.info("Job status is Aborted")
       else:
          logging.error("Job status is not Aborted")
          raise GeneralError("","Error !!! Job status is not Aborted")

       result=utils.run_command_continue_on_error("glite-wms-job-logging-info --event Match %s"%(JOBID))

       used_ces=[]

       for line in result.split("\n"):
         if line.find("Dest id") !=-1 :
            used_ces.append(line.split("=")[1].strip())

       for CE in used_ces :
         if CE!=  dest_CE :
          logging.error("Test failed, not found 3 times the name of the previously choosen CE. Target CE: %s while found %s"%(dest_CE,CE))
          raise GeneralError("","Error !!! Test failed, not found 3 times the name of the previously choosen CE. Target CE: %s while found %s"%(dest_CE,CE))


       logging.info("Test OK")
Beispiel #5
0
def run(utils):

    bug='34508'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to WMS. You have set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file")

    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("Stop glite-wms-wm")

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm stop")

    logging.info("Prepare jdl file for submission")

    #Neccessary to avoid overwrite of the external jdls
    utils.use_utils_jdl()
   
    Job_utils.prepare_collection_job(utils,utils.get_jdl_file())

    logging.info("Submit collection")

    JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg --collection %s/collection_jdls"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_tmp_dir()))

    logging.info("Job submitted successfuly. Returned JOBID: %s",JOBID)

    logging.info("Start glite-wms-wm")

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm start")

    logging.info("Wait until collection is finished")

    utils.wait_until_job_finishes (JOBID)

    logging.info("Check final status of collection")

    utils.job_status(JOBID)

    if utils.JOBSTATUS.find('Done (Success)') == -1 :
        logging.error("Job not finished successfully. Job final status is '%s' instead of 'Done (Success)'"%(utils.get_job_status()))
        raise GeneralError("Check job final status","Job not finished successfully. Job final status is '%s' instead of 'Done (Success)'"%(utils.get_job_status()))
    else:
         logging.info("Collection finished successfully. Test OK")

    logging.info("End of regression test for bug %s"%(bug))
Beispiel #6
0
def run(utils):

    logging.info("Start regression test for bug 73711")

    logging.warning("To verify this bug you need a WMS set in proxy mode only ")

    # Neccessary to avoid overwrite of the external jdls
    utils.use_utils_jdl()

    utils.set_jdl(utils.get_jdl_file())

    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()))

    logging.info("Cancel submitted job")

    utils.run_command_continue_on_error("glite-wms-job-cancel --noint %s"%(JOBID))

    if JOBID.find(utils.get_WMS()) == -1:
        logging.info("Job submitted successfuly. Returned JOBID: %s",JOBID)
    else:
        logging.warning("WMS is not set in 'proxy' mode only. We can't verify the bug.")
        raise GeneralError("Check LBServer","WMS is not set in 'proxy' mode only. We can't verify the bug.")

    logging.info("Prepare a job collecion")

    Job_utils.prepare_collection_job(utils,utils.get_jdl_file())
     
    JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg --collection %s/collection_jdls"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_tmp_dir()))

    logging.info("Job submitted successfuly. Returned JOBID: %s",JOBID)

    logging.info("Cancel submitted job")

    utils.run_command_continue_on_error("glite-wms-job-cancel --noint %s"%(JOBID))
    
    if JOBID.find(utils.get_WMS()) == -1:
        logging.info("Job submitted successfuly. Returned JOBID: %s",JOBID)
    else:
        logging.warning("WMS is not set in 'proxy' mode only. We can't verify the bug.")
        raise GeneralError("Check LBServer","WMS is not set in 'proxy' mode only. We can't verify the bug.")   

    logging.info("End of regression test for bug 73711")
Beispiel #7
0
def run(utils):


    logging.info("Start regression test for bug 70824")
    
    OUTPUT="ATHENA_RUN_EVENTS=[(152345L, 216721L)]" # expected output
    
    # we need to test both lcg CE and CREAM CE
    
    for dest in ("/cream-", "2119/jobmanager") :
        
        utils.use_external_jdl("70824.jdl")
    
        utils.set_destination_ce(utils.get_jdl_name(), dest)

        Job_utils.submit_output_normal_job(utils, dest)

        ### Now check the job out output

        logging.info("Check if job output is as expected")

        FILE = open("%s/env.out"%(utils.get_job_output_dir()),"r")

        lines = FILE.readlines()

        R_OUTPUT=""

        for line in lines :
            if line.find("ATHENA_RUN_EVENTS") != -1: 
                R_OUTPUT=line[:-1] # remove the newline 
                break 

        FILE.close()

        if OUTPUT != R_OUTPUT :
            logging.error("Output is not as expected. We get output '%s' while expected '%s'",R_OUTPUT,OUTPUT)
            raise GeneralError("Check output","Not expected output. (Get %s expect %s)"%(R_OUTPUT,OUTPUT))
        else:
            logging.info("Output is as expected. Test OK")


    logging.info("End of regression test for bug 70824")
Beispiel #8
0
def run(utils):

    bug='77876'

    logging.info("Start regression test for bug %s"%(bug))

    logging.info("Submit job collection")

    utils.use_utils_jdl()

    Job_utils.prepare_collection_job(utils,utils.get_jdl_file(),"")
    
    JOBID=Job_utils.submit_collection_wait_finish(utils,"")

    utils.job_status(JOBID)
    
    if utils.get_job_status().find('Done') != -1 :
    
        logging.info("Get job output")

        # Get output
        utils.run_command_continue_on_error ("glite-wms-job-output --noint --dir %s %s "%(utils.get_job_output_dir(),JOBID))

        logging.info("Check job status")

        res=utils.run_command_continue_on_error("glite-wms-job-status -v 0 %s"%(JOBID))

        num=res.count("Current Status:     Cleared")

        if num == 4 :
            logging.info("All nodes have CLEARED status")
        else:
            logging.error("Not all nodes have CLEARED status. Get %s expected 4"%(num))
            raise GeneralError("Count Cleared status","Not all nodes have CLEARED status. Get %s expected 4"%(num))
        
    else:
        logging.error("Job not finished successfully. Retry the test.")
        raise RetryError("Check job final status","Job not finished successfully.")

   
    logging.info("End of regression test for bug %s"%(bug))
Beispiel #9
0
def run(utils):

    bug='36145'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to WMS. You have set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file")

    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("Set DispatcherType=\"jobdir\";  and  Input=\"${WMS_LOCATION_VAR}/workload_manager/jobdir\"; to glite_wms.conf at WMS")

    attributes=['DispatcherType','Input']
    new=['\"jobdir\"','\"${WMS_LOCATION_VAR}/workload_manager/jobdir\"']
  
    utils.change_attribute_at_remote_file_section(ssh,"/etc/glite-wms/glite_wms.conf",attributes[0],'WorkloadManager',new[0])
    utils.change_attribute_at_remote_file_section(ssh,"/etc/glite-wms/glite_wms.conf",attributes[1],'WorkloadManager',new[1])

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")

    logging.info("Submit the job and wait to finish")

    utils.use_external_jdl("%s.jdl"%(bug))

    logging.info("Submit the job and wait to finish")

    utils.set_destination_ce(utils.get_jdl_file(),"2119/jobmanager")

    JOBID=Job_utils.submit_wait_finish(utils)

    logging.info("Check job's final status")

    utils.job_status(JOBID)

    if utils.JOBSTATUS.find('Done (Success)') == -1 :
        logging.error("Job not finished successfully. Job final status is '%s' instead of 'Done (Success)'"%(utils.get_job_status()))
        utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
        utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
        raise GeneralError("Check job final status","Job not finished successfully. Job final status is '%s' instead of 'Done (Success)'"%(utils.get_job_status()))
    else:
         logging.info("Job finished successfully.")


    logging.info("Restore the initial glite_wms.conf file")

    utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
    

    ssh.close()

    logging.info("End of regression test for bug %s"%(bug))
Beispiel #10
0
def run(utils):

    bug = "48636"

    logging.info("Start regression test for bug %s" % (bug))

    logging.warning(
        "To verify this bug you need access to WMS. You have set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file"
    )

    ssh = utils.open_ssh(utils.get_WMS(), utils.get_Username(), utils.get_Password())

    logging.info("Set MaxOutputSandboxSize=50M; to glite_wms.conf at WMS")

    utils.change_remote_file(ssh, "/etc/glite-wms/glite_wms.conf", ["MaxOutputSandboxSize"], ["*"], ["50M"])

    logging.info("Restart workload manager glite-wms-wm")

    utils.execute_remote_cmd(ssh, "/etc/init.d/glite-wms-wm restart")

    logging.info("Submit the job and wait to finish")

    utils.use_external_jdl("%s.jdl" % (bug))

    JOBID = Job_utils.submit_wait_finish(utils, "")

    logging.info("Check job status")

    result = utils.run_command_continue_on_error("glite-wms-job-logging-info -v 3 --event UserTag %s" % (JOBID))

    if result.find("OSB quota exceeded for") == -1:
        logging.error("Not found message 'OSB quota exceeded for' at UserTag")
        utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
        utils.execute_remote_cmd(ssh, "/etc/init.d/glite-wms-wm restart")
        raise GeneralError("Check UserTag event", "Not found message 'OSB quota exceeded for' at UserTag")

    if result.find("Truncated last 52428800 bytes for file") == -1:
        logging.error("Not found message 'Truncated last 52428800 bytes for file")
        utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
        utils.execute_remote_cmd(ssh, "/etc/init.d/glite-wms-wm restart")
        raise GeneralError(
            "Check UserTag event", "Not found message 'Truncated last 52428800 bytes for file' at UserTag"
        )

    logging.info("Restore the initial glite_wms.conf file")

    utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")

    utils.execute_remote_cmd(ssh, "/etc/init.d/glite-wms-wm restart")

    ssh.close()

    logging.info("End of regression test for bug %s" % (bug))
Beispiel #11
0
def run(utils):

    bug='73699'

    logging.info("Start regression test for bug %s"%(bug))

    utils.use_external_jdl("%s.jdl"%(bug))

    JOBID=Job_utils.submit_wait_finish(utils,"")

    # Check for job status

    logging.info("Check job stauts")

    utils.job_status(JOBID)


    if utils.get_job_status()=="Aborted":
        logging.info("Job status is Aborted")
    else:
      logging.error("Job status is not Aborted")
      raise GeneralError("Check job status","Job status is not 'Aborted' but %s"%(utils.get_job_status()))


    # Check the aborted reason
    
    reason=utils.get_StatusReason(JOBID)

    if reason != "hit job retry count (3)":
        logging.error("Wrong reason: %s"%(reason))
        raise GeneralError("Check aborted reason","Wrong reason: %s"%(reason))
    else:
        logging.info("Retry count is 3 as expected")  

    # Check the number of resubmission events

    logging.info("Check the number of resubmission events")

    result=utils.run_command_continue_on_error("glite-wms-job-logging-info -v 2 --event Resubmission  %s"%(JOBID)).count("WILLRESUB")

    if result == 7 :
        logging.info("Test PASS")
    else:
      logging.error("Wrong number of resubmission events. Get %s expected 7"%(result))
      raise GeneralError("Check resubmission events","Wrong number of resubmission events. Get %s expected 7"%(result))

   
    logging.info("End of regression test for bug %s",bug)
Beispiel #12
0
def run(utils):

    bug='73715'

    logging.info("Start regression test for bug %s"%(bug))
    
    # we need to test both lcg CE and CREAM CE
    
    for dest in ("/cream-", "2119/jobmanager") :
    
        logging.info("Prepare jdl file for submission to a ce like %s"%(dest))

        # Necessary to avoid overwrite of the external jdls
        utils.use_utils_jdl()
        utils.set_jdl(utils.get_jdl_file())
        utils.set_destination_ce(utils.get_jdl_name(), dest)

        JOBID=Job_utils.submit_wait_finish(utils, dest)
        utils.job_status(JOBID)

        find=0

        if utils.JOBSTATUS.find('Done (Success)') != -1 :

            logging.info("Look for the ReallyRunning event from LogMonitor in the logging info")

            result=utils.run_command_continue_on_error("glite-wms-job-logging-info -v 3 --event ReallyRunning %s"%(JOBID))

            for line in result.split("\n") :
                if line.find("Source")!=-1:
                    source=line.split("=")[1]
                    if source.find("LogMonitor")!=-1:
                        find=1
                        break

            if find == 0:
                logging.error("Not found ReallyRunning event from LogMonitor")
                raise GeneralError("Check ReallyRunning events","Not found ReallyRunning event from LogMonitor")
            else:
                logging.info("Found ReallyRunning event from LogMonitor as expected. Test PASS")
                
        else:
            logging.error("Job not finished successfully. Retry the test.")
            raise RetryError("Check job final status","Job not finished successfully.") 

    logging.info("End of regression test for bug %s"%(bug))
Beispiel #13
0
def run(utils):

    bug='75223'

    logging.info("Start regression test for bug %s"%(bug))

    logging.info("Prepare jdl file for submission")

    for dest in ("/cream-", "2119/jobmanager") :
    
        # Necessary to avoid overwrite of the external jdls
        utils.use_utils_jdl()
        utils.set_jdl(utils.get_jdl_file())
        utils.set_destination_ce(utils.get_jdl_name(), dest)
        utils.add_jdl_attribute(utils.get_jdl_file(),"Prologue","\"/bin/false\"")

        JOBID=Job_utils.submit_wait_finish(utils,dest)

        logging.info("Check if failed reason is 'Prologue failed with error 1'")
    
        result=utils.run_command_continue_on_error("glite-wms-job-logging-info -v 2 --event Done %s"%(JOBID))
 
        blocks=result.split('Event: Done')

        logmonitor_reasons=[]

        for block in blocks:
          if block.find('LogMonitor')!=-1:
             lines=block.split('\n')
             for line in lines:
                if line.find('Reason')!=-1:
                  logmonitor_reasons.append(line.split(' = ')[1].strip(' \t\n'))
                  break

        
        for reason in logmonitor_reasons:
            if reason!='Prologue failed with error 1' and reason!='prologue failed with error 1':
                logging.error("Wrong faild reason for LogMonitor. Found '%s' , while expected is 'Prologue failed with error 1'",reason)
                raise GeneralError("Check failend reasons for LogMonitor","Wrong failed reason. Found %s , while expected is 'Prologue failed with error 1'"%(reason))
                break
        
    logging.info("End of regression test for bug %s"%(bug))
Beispiel #14
0
def run(utils):

    bug='92922'

    logging.info("Start regression test for bug %s"%(bug))

    logging.info("Prepare jdl file for submission")

    utils.use_external_jdl("%s.jdl"%(bug))

    JOBID=Job_utils.submit_wait_finish(utils)

    logging.info("Check job's exit code")
    
    output=utils.run_command_continue_on_error("glite-wms-job-status %s"%(JOBID))
 
    exit_code=''
    status=''
    
    for line in output.split("\n"):

        if line.find("Exit code:")!=-1:
            exit_code=line.split(":")[1].strip(" \t\n")

        if line.find("Current Status:")!=-1:
            status=line.split(":")[1].strip(" \t\n")

    if status.find("Done(Exit Code !=0)")==-1:
        logging.error("Wrong final status. Get %s, while expected 'Done(Exit Code !=0)'"%(status))
        raise GeneralError("Check job's final status","Wrong final status. Get %s , while expected 'Done(Exit Code !=0)'"%(status))
    else:
        logging.info("Job's final status is 'Done(Exit Code !=0)' as expected")

    if int(exit_code)==0:
        logging.error("Wrong exit code. Found 0 , while expected != 0 ")
        raise GeneralError("Check job's exit code","Wrong exit code. Found 0, while expected != 0")
    else:
        logging.info("Job's exit code is not 0 as expected")

    logging.info("End of regression test for bug %s"%(bug))
Beispiel #15
0
def run(utils):

    bug='58878'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to WMS. You have to set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file")

    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("CASE 1 : Use LCG-CE")

    logging.info("Insert into the Workload Management section of glite_wms.conf the PropagageToLRMS section")

    value="{\n [ name = \"smpgranularity\"; value = jdl.SMPGranularity ],\n[ name = \"wholenodes\"; value = jdl.WholeNodes ; requires = jdl.WholeNodes == true; ],\n[ name = \"hostsmpsize\"; value = ce.GlueHostArchitectureSMPSize ],\n[ name = \"mpi_type\"; value = jdl.MpiType; requires = ce.GlueCEInfoLRMSType == \"lsf\"; ],\n[ name = \"hostmainmem\"; value = ce.GlueHostMainMemoryRAMSize; requires = ce.GlueCEInfoLRMSType == \"pbs\"; ]\n}"

    utils.add_attribute_to_remote_file(ssh,"/etc/glite-wms/glite_wms.conf","WorkloadManager",['PropagateToLRMS'],[value])

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")

    utils.use_utils_jdl()
    utils.set_jdl(utils.get_jdl_file())

    smp_granularity=2
    mpi_type="mvapich_gcc4"

    logging.info("Append the jdl file with the required attributes")
    utils.add_jdl_general_attribute(utils.get_jdl_file(),"SMPGranularity",smp_granularity)
    utils.add_jdl_attribute(utils.get_jdl_file(),"MpiType",mpi_type)
    utils.set_destination_ce(utils.get_jdl_file(),"2119/jobmanager")

    logging.info("Submit the job to LCG-CE and wait to finish")

    JOBID=Job_utils.submit_wait_finish(utils,"2119/jobmanager")

    logging.info("Check job status")

    output=utils.run_command_continue_on_error("glite-wms-job-logging-info -v 3 --event Enqueued %s"%(JOBID))

    for line in output.split("\n"):
        if line.find("GlobusRSL")!=-1:
            arguments=line.split("arguments=")[1][1:-5]
            break

    output=utils.run_command_continue_on_error("glite-wms-job-status %s"%(JOBID)).split("\n")

    for line in output:
        if line.find("Destination:")!=-1:
            line=line.split("Destination:")[1]
            CE=line.split(":2119")[0].strip(" \t\n")

    lrms_type=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueCEInfoLRMSType"%(CE))
    lrms_type=lrms_type.split(":")[1].strip(" \t\n")

    smp_size=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueHostArchitectureSMPSize"%(CE))
    smp_size=smp_size.split(":")[1].strip(" \t\n")

    host_mem=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueHostMainMemoryRAMSize"%(CE))
    host_mem=host_mem.split(":")[1].strip(" \t\n")

    arguments=arguments.split(",")

    target=['smpgranularity=%s'%(smp_granularity),'hostsmpsize=%s'%(smp_size)]

    if lrms_type=="pbs":
        target.append("hostmainmem=%s"%(host_mem))
    elif lrms_type=="lsf":
        target.append("mpi_type=%s"%(mpi_type))


    z=set(target)&set(arguments)

    if len(z)!=len(target):
       utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
       utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
       ssh.close()
       logging.error("Unable to find all the expected attributes. \n Passed: %s \n Expected: %s"%(arguments,target))
       raise GeneralError("","Unable to find all the expected attributes. \n Passed: %s \n Expected: %s"%(arguments,target))
    else:
       logging.info("CASE 1 OK.\n Passed: %s \nExpected: %s"%(arguments,target))
    
    logging.info("CASE 2 : Use CREAM CE")

    utils.use_utils_jdl()
    utils.set_jdl(utils.get_jdl_file())

    smp_granularity=1
    mpi_type="mvapich_gcc4"

    logging.info("Append the jdl file with the required attributes")
    utils.add_jdl_general_attribute(utils.get_jdl_file(),"SMPGranularity",smp_granularity)
    utils.add_jdl_attribute(utils.get_jdl_file(),"MpiType",mpi_type)
    utils.set_destination_ce(utils.get_jdl_file(),"/cream-")

    logging.info("Submit the job to CREAM CE and wait to finish")

    JOBID=Job_utils.submit_wait_finish(utils,"/cream-")

    logging.info("Check job status")

    output=utils.run_command_continue_on_error("glite-wms-job-logging-info -v 3 --event Transfer %s"%(JOBID))


    for line in output.split("\n"):
        if line.find("CeRequirements")!=-1:
            arguments=line.split("CeRequirements = ")[1]
            arguments=arguments.split(") )&&")[1][:-3]
            break

    
    output=utils.run_command_continue_on_error("glite-wms-job-status %s"%(JOBID)).split("\n")

    for line in output:
        if line.find("Destination:")!=-1:
            line=line.split("Destination:")[1]
            CE=line.split(":8443")[0].strip(" \t\n")

    lrms_type=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueCEInfoLRMSType"%(CE))
    lrms_type=lrms_type.split(":")[1].strip(" \t\n")

    smp_size=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueHostArchitectureSMPSize"%(CE))
    smp_size=smp_size.split(":")[1].strip(" \t\n")

    host_mem=utils.run_command_continue_on_error("ldapsearch -x -h %s:2170 -b o=grid | grep GlueHostMainMemoryRAMSize"%(CE))
    host_mem=host_mem.split(":")[1].strip(" \t\n")

    arguments=arguments.split("&&")

    target=['smpgranularity==%s'%(smp_granularity),'hostsmpsize==%s'%(smp_size)]

    if lrms_type=="pbs":
        target.append("hostmainmem==%s"%(host_mem))
    elif lrms_type=="lsf":
        target.append("mpi_type==%s"%(mpi_type))


    z=set(target)&set(arguments)

    if len(z)!=len(target):
       utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")
       utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")
       ssh.close()
       logging.error("Unable to find all the expected attributes. \n Passed: %s \n Expected: %s"%(arguments,target))
       raise GeneralError("","Unable to find all the expected attributes. \n Passed: %s \n Expected: %s"%(arguments,target))
    else:
       logging.info("CASE 2 OK.\n Passed: %s \nExpected: %s"%(arguments,target))

    logging.info("TEST OK")

    logging.info("Restore the initial glite_wms.conf file")

    utils.execute_remote_cmd(ssh, "cp -f /etc/glite-wms/glite_wms.conf.bak /etc/glite-wms/glite_wms.conf")

    utils.execute_remote_cmd(ssh,"/etc/init.d/glite-wms-wm restart")

    ssh.close()

    logging.info("End of regression test for bug %s"%(bug))
    
    
Beispiel #16
0
def run(utils):

    bug = "45883"

    logging.info("Start regression test for bug %s" % (bug))

    utils.use_external_jdl("%s.jdl" % (bug))

    logging.info("Get availabe CEs for job submission")

    result = 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())
    )

    available_ces = []

    for line in result.split("\n"):
        if line.find(" - ") != -1:
            available_ces.append(line.split(" - ")[1].split(":")[0])

    logging.info("Submit job and wait to finish")

    JOBID = Job_utils.submit_wait_finish(utils, "")

    logging.info("Check job final stauts")

    utils.job_status(JOBID)

    if utils.get_job_status() == "Aborted":
        logging.info("Job status is Aborted")
    else:
        logging.error("Job status is not Aborted")
        raise GeneralError("Check job status", "Error !!! Job status is not Aborted")

    logging.info("Get the used CEs")

    result = utils.run_command_continue_on_error("glite-wms-job-logging-info --event Match %s" % (JOBID))

    used_ces = []

    for line in result.split("\n"):
        if line.find("Dest id") != -1:
            used_ces.append(line.split("=")[1].strip().split(":")[0])

    logging.info("Check the used CEs")

    z = set(available_ces) & set(used_ces)

    if len(available_ces) <= 4:

        if len(z) != len(available_ces):
            logging.error(
                "Resubmission did not use all the available CEs. Used only %s while available CEs was %s"
                % (len(z), len(available_ces))
            )
            raise GeneralError(
                "",
                "Error !!!. Resubmission did not use all the available CEs. Used only %d while available CEs was %d"
                % (len(z), len(available_ces)),
            )

    else:

        if len(z) != 4:
            logging.error(
                "Resubmission did not prefer different CEs. Used CEs %s while available CEs was %s"
                % (len(z), len(available_ces))
            )
            raise GeneralError(
                "",
                "Error !!!. Resubmission did not prefer different CEs. Used CEs %d while available CEs was %d"
                % (len(z), len(available_ces)),
            )

    logging.info("TEST OK")

    logging.info("End of regression test for bug %s", bug)
Beispiel #17
0
def run(utils):

    bug='79141'

    logging.info("Start regression test for bug %s"%(bug))

    logging.info("Submit a parametric job and wait until finish")

    utils.use_external_jdl("%s.jdl"%(bug))
    
    JOBID=Job_utils.submit_wait_finish(utils,"")
    
    jdl=utils.run_command_continue_on_error("glite-wms-job-info --jdl %s"%(JOBID))
    
    if (jdl.find("input/Makefile") == -1 or jdl.find("input/Test0") == -1):
        logging.error("Final submitted jdl (%s) is not correct"%(jdl))
        raise GeneralError("Check submitted jdl","Final submitted jdl (%s) is not correct"%(jdl))         

    logging.info("Check job output")

    utils.job_status(JOBID)

    if utils.JOBSTATUS.find('Done (Success)') != -1 :

        # Check job output
        DIR=Job_utils.output_parametric_job(utils,JOBID)
    
        if os.path.isdir(DIR):
            logging.info("Basic output directory exists")
        else:
            logging.error("Basic output directory does not exist")
            raise GeneralError("Check output files","Basic output directory does not exist")
    

        logging.info("Check if node directory is correctly created")

        if os.path.isdir("%s/Node_0"%(DIR)) :
            logging.info("Node directory is collectly created")
        else:
            logging.error("Node directory is not collectly created")
            raise GeneralError("Check output files","Node directories are not correctly created")
               

        logging.info("Check if the output files are correctly retrieved")

        if os.path.isfile("%s/Node_0/output.txt"%(DIR)) :
            logging.info("Output files are collectly retrieved")    
        else:
            logging.error("Output files are not collectly retrieved")
            raise GeneralError("Check output files","Output files are not collectly retrieved")


        logging.info("Check for files Makefile and Test0 at output.txt")

        outfile=open("%s/Node_0/output.txt"%(DIR), "r")
    
        line=outfile.read()
    
        outfile.close()

        if ( line.find("Makefile") != 1 and line.find("Test0")):
            logging.info("Both files are listed at output.txt")
        else:
            logging.error("Not both files are listed at output.txt")
            raise GeneralError("Check output file","Not both files are listed at output.txt")
    
    else:
        logging.error("Job not finished successfully. Retry the test.")
        raise RetryError("Check job final status","Job not finished successfully.")


    logging.info("End of regression test for bug %s"%(bug))
Beispiel #18
0
def run(utils):

    bug='83453'

    logging.info("Start regression test for bug %s"%(bug))

    logging.warning("To verify this bug you need access to WMS. You have set WMS_USERNAME and WMS_PASSOWRD attributes at configuration file")

    ssh=utils.open_ssh(utils.get_WMS(),utils.get_Username(),utils.get_Password())

    logging.info("Prepare jdl file for submission")

    Job_utils.prepare_collection_job(utils,utils.get_jdl_file(),"/cream-")

    logging.info("Submit collection job")

    JOBID=utils.run_command_continue_on_error ("glite-wms-job-submit %s --config %s --nomsg --collection %s/collection_jdls"%(utils.get_delegation_options(),utils.get_config_file(),utils.get_tmp_dir()))

    logging.info("Job submitted successfuly. Returned JOBID: %s",JOBID)

    output=utils.run_command_continue_on_error("glite-wms-job-status -v 0 %s"%(JOBID))
 
    IDS=[]
     
    for line in output.split("\n"):
        if line.find("the Job :")!=-1:
             IDS.append(line.split("the Job :")[1].strip(" \n\t"))


    logging.info("Check file /var/log/messages")

    output=utils.execute_remote_cmd(ssh,"grep glite-proxy-renewd /var/log/messages" )

    for id in IDS[1:]:

        logging.info("Proxy registration for job %s"%(id))

        if output.find("of job %s has been registered as")==-1:
            ssh.close()
            logging.error("Unable to find proxy registration for job %s"%(id))
            utils.run_command_continue_on_error("glite-wms-job-cancel --noint %s"%(JOBID))
            raise GeneralError("Check file /var/log/messages","Unable to find proxy registration for job %s"%(id))
        else:
           logging.info("Successful proxy registration for job %s"%(id))


    logging.info("Wait until job finished")

    utils.wait_until_job_finishes(JOBID)

    logging.info("Check again file /var/log/messages")

    output=utils.execute_remote_cmd(ssh,"grep glite-proxy-renewd /var/log/messages" )

    for id in IDS[1:]:

        logging.info("Proxy unregistration for job %s"%(id))

        if output.find("of job %s has been unregistered")==-1:
            ssh.close()
            logging.error("Unable to find proxy unregistration for job %s"%(id))
            raise GeneralError("Check file /var/log/messages","Unable to find proxy unregistration for job %s"%(id))
        else:
           logging.info("Successful proxy unregistration for job %s"%(id))
    
    
    ssh.close()

    logging.info("End of regression test for bug %s"%(bug))