def task_worker_load_nse_conditions(itask, nse_iset_number): sleep_cnt = 0 for i in range(1, nse_iset_number + 1): first_print_debug_log = True if i not in itask.loaded_non_se_condition_files: complete_flag = isnse.get_transport_complete_flag_file( *itask.k_m_n, i) transport_complete = False while not transport_complete: if first_print_debug_log: logging.info("waiting for transport complete file %s" % complete_flag) first_print_debug_log = False if sleep_cnt == 10: return False if pathlib.Path(complete_flag).exists(): transport_complete = True else: sleep_cnt += 1 time.sleep(5) nse_conditions = isnse.load_kmn_non_se_results( *itask.k_m_n, i, itask.lp_type, itask.is_use_extended_rules) itask.non_se_conditions.extend(nse_conditions) itask.loaded_non_se_condition_files.add(i) return True
def update_nse_files_to_new_host(host_ip, itasks): nse_files = list() complete_flags = list() for it in itasks: for i in it.non_se_condition_files: nse_files.append( isnse.get_nse_condition_file_path(*it.k_m_n, i, it.lp_type, it.is_use_extended_rules)) complete_flags.append( isnse.get_transport_complete_flag_file(*it.k_m_n, i)) isnse.transport_non_se_results(nse_files, [host_ip]) isnse.transport_non_se_results(complete_flags, [host_ip])
def task_worker_load_nse_conditions(itask, nse_iset_number): for i in range(1, nse_iset_number + 1): if i not in itask.loaded_non_se_condition_files: complete_flag = isnse.get_transport_complete_flag_file( *itask.k_m_n, i) transport_complete = False while not transport_complete: if pathlib.Path(complete_flag).exists(): transport_complete = True else: time.sleep(3) nse_conditions = isnse.load_kmn_non_se_results( *itask.k_m_n, i, itask.lp_type, itask.is_use_extended_rules) itask.non_se_conditions.extend(nse_conditions) itask.loaded_non_se_condition_files.add(i)
def task_worker_load_nse_conditions(itask, ne_iset_number): load_complete = True for i in range(1, ne_iset_number): if i not in itask.loaded_non_se_condition_files: complete_flag = isnse.get_transport_complete_flag_file( *itask.k_m_n, i) if pathlib.Path(complete_flag).exists(): nse_conditions = isnse.load_kmn_non_se_results( *itask.k_m_n, i, itask.lp_type, itask.is_use_extended_rules) itask.non_se_conditions.extend(nse_conditions) itask.loaded_non_se_condition_files.add(i) else: load_complete = False break return load_complete