def check_for_bug_94414(jobs_list): ''' | Description: | Given a dictionary of couples cream_job_id:job_status | | | check if status is DONE-OK and if in blparser log file | | | notifications for suspended and resumed jobs are present | | Arguments: | jobs_statuses | dictionary of couples | | | cream_job_id:job_status | | Returns: | SUCCESS/FAILED | | Exceptions: | | ''' ret_val = ['CHECK SUCCESSFUL', 'CHECK FAILED'] final_ret_val = ret_val[0] my_conf = cream_testsuite_conf.CreamTestsuiteConfSingleton() output_dir = my_conf.getParam('testsuite_behaviour', 'tmp_dir') print "Getting final jobs status ... " jobs_final_states, failed_jobs = cream_regression.get_n_job_status( jobs_list, "DONE-OK", 200) keys = jobs_final_states.keys() for index in keys: print "Job " + str(index) + " --- " + jobs_final_states[index] if len(failed_jobs) == 0: print "Statuses check successful" final_ret_val = ret_val[0] else: print "Statuses check failed" final_ret_val = ret_val[1] # Check also blparser notifications because cream has a mechanism to detect job done independently by blparser blparser_log = blah_testing.get_blah_parser_log_file_name() local_blah_parser_log_file = cream_regression.get_file_from_ce( blparser_log, output_dir) for cream_job_id in keys: batch_job_id = blah_testing.get_job_num_from_jid(cream_job_id) notifications_list = blah_testing.get_notifications_in_blah_parser_log( local_blah_parser_log_file, batch_job_id) result = blah_testing.check_notifications_for_normally_finished( notifications_list) if result == 'NOTIFICATIONS OK': print "Notifications check successful for job " + cream_job_id else: print "Notifications failure for job " + cream_job_id final_ret_val = ret_val[1] return final_ret_val
def check_for_bug_94414(jobs_list): ''' | Description: | Given a dictionary of couples cream_job_id:job_status | | | check if status is DONE-OK and if in blparser log file | | | notifications for suspended and resumed jobs are present | | Arguments: | jobs_statuses | dictionary of couples | | | cream_job_id:job_status | | Returns: | SUCCESS/FAILED | | Exceptions: | | ''' ret_val = ['CHECK SUCCESSFUL', 'CHECK FAILED'] final_ret_val = ret_val[0] my_conf = cream_testsuite_conf.CreamTestsuiteConfSingleton() output_dir = my_conf.getParam('testsuite_behaviour','tmp_dir') print "Getting final jobs status ... " jobs_final_states, failed_jobs = cream_regression.get_n_job_status(jobs_list, "DONE-OK", 200) keys = jobs_final_states.keys() for index in keys: print "Job " + str(index) + " --- " + jobs_final_states[index] if len(failed_jobs) == 0: print "Statuses check successful" final_ret_val = ret_val[0] else: print "Statuses check failed" final_ret_val = ret_val[1] # Check also blparser notifications because cream has a mechanism to detect job done independently by blparser blparser_log = blah_testing.get_blah_parser_log_file_name() local_blah_parser_log_file = cream_regression.get_file_from_ce(blparser_log, output_dir) for cream_job_id in keys: batch_job_id = blah_testing.get_job_num_from_jid(cream_job_id) notifications_list = blah_testing.get_notifications_in_blah_parser_log(local_blah_parser_log_file, batch_job_id) result = blah_testing.check_notifications_for_normally_finished(notifications_list) if result == 'NOTIFICATIONS OK': print "Notifications check successful for job " + cream_job_id else: print "Notifications failure for job " + cream_job_id final_ret_val = ret_val[1] return final_ret_val
# At the end of the test cancel all submitted job to free the batch system #print "Saturating batch system" job_ids_list = blah_testing.saturate_batch_system(jdl_fname) print "send other 10 jobs" cream_job_ids = list() cream_job_ids = blah_testing.submit_n_jobs(10, jdl_fname) submitted_jobs = cream_job_ids + job_ids_list cream_regression.suspend_n_jobs(submitted_jobs) print "sleep 90" time.sleep(90) cream_regression.resume_n_jobs(submitted_jobs) print "sleep 360" time.sleep(360) print "Getting final jobs status ... " jobs_final_states, failed_jobs = cream_regression.get_n_job_status( submitted_jobs, "DONE-OK", 200) #jobs_final_states = {'https://cream-48.pd.infn.it:8443/CREAM343000020': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM860080984': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM165998598': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM272504930': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM028643262': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM031420087': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM175340630': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM860441571': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM314754532': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM900734086': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM925052464': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM583028808': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM796407022': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM346998990': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM381465963': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM909432116': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM070883268': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM096224245': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM579038454': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM500294263': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM380152351': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM272710161': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM751432700': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM709859316': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM327028920': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM972118020': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM916207691': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM076071699': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM610050083': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM428607805': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM932934778': 'DONE-OK'} res = blah_regression.check_for_bug_94414(jobs_final_states) print res print "Cancelling all jobs..." cream_testing.cancel_all_jobs("cream-48.pd.infn.it:8443")
#print "Saturating batch system" job_ids_list = blah_testing.saturate_batch_system(jdl_fname) print "send other 10 jobs" cream_job_ids = list() cream_job_ids = blah_testing.submit_n_jobs(10, jdl_fname) submitted_jobs = cream_job_ids + job_ids_list cream_regression.suspend_n_jobs(submitted_jobs) print "sleep 90" time.sleep(90) cream_regression.resume_n_jobs(submitted_jobs) print "sleep 360" time.sleep(360) print "Getting final jobs status ... " jobs_final_states, failed_jobs = cream_regression.get_n_job_status(submitted_jobs, "DONE-OK", 200) #jobs_final_states = {'https://cream-48.pd.infn.it:8443/CREAM343000020': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM860080984': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM165998598': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM272504930': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM028643262': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM031420087': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM175340630': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM860441571': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM314754532': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM900734086': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM925052464': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM583028808': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM796407022': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM346998990': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM381465963': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM909432116': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM070883268': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM096224245': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM579038454': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM500294263': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM380152351': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM272710161': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM751432700': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM709859316': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM327028920': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM972118020': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM916207691': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM076071699': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM610050083': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM428607805': 'DONE-OK', 'https://cream-48.pd.infn.it:8443/CREAM932934778': 'DONE-OK'} res = blah_regression.check_for_bug_94414(jobs_final_states) print res print "Cancelling all jobs..." cream_testing.cancel_all_jobs("cream-48.pd.infn.it:8443")