Exemple #1
0
    def __init__(self, cpu_usage_predictor_manager: CpuUsagePredictorManager,
                 config_manager: ConfigManager,
                 free_thread_provider: FreeThreadProvider):
        self.__reg = None
        self.__time_bound_call_count = 0
        self.__rebalance_failure_count = 0
        self.__ip_solver_params = IPSolverParameters(
            alpha_nu=config_manager.get_float(ALPHA_NU, DEFAULT_ALPHA_NU),
            alpha_llc=config_manager.get_float(ALPHA_LLC, DEFAULT_ALPHA_LLC),
            alpha_l12=config_manager.get_float(ALPHA_L12, DEFAULT_ALPHA_L12),
            alpha_prev=config_manager.get_float(ALPHA_PREV,
                                                DEFAULT_ALPHA_PREV))

        self.__solver_max_runtime_secs = config_manager.get_float(
            MAX_SOLVER_RUNTIME, DEFAULT_MAX_SOLVER_RUNTIME)
        self.__solver_name = config_manager.get_str(MIP_SOLVER,
                                                    DEFAULT_MIP_SOLVER)
        self.__solver_mip_gap = config_manager.get_float(
            RELATIVE_MIP_GAP_STOP, DEFAULT_RELATIVE_MIP_GAP_STOP)
        self.__cpu_usage_predictor_manager = cpu_usage_predictor_manager
        self.__config_manager = config_manager
        self.__free_thread_provider = free_thread_provider
        self.__cnt_rebalance_calls = 0
        self.__call_meta = None  # track things __place_threads call
Exemple #2
0
def get_free_thread_provider(
        config_manager: ConfigManager) -> FreeThreadProvider:
    free_thread_provider_str = config_manager.get_str(
        FREE_THREAD_PROVIDER, DEFAULT_FREE_THREAD_PROVIDER)
    free_thread_provider = None

    total_threshold = config_manager.get_float(TOTAL_THRESHOLD,
                                               DEFAULT_TOTAL_THRESHOLD)

    if free_thread_provider_str == EMPTY:
        free_thread_provider = EmptyFreeThreadProvider()
    elif free_thread_provider_str == OVERSUBSCRIBE:
        free_thread_provider = OversubscribeFreeThreadProvider(total_threshold)

    log.debug("Free thread provider: '{}'".format(
        free_thread_provider.__class__.__name__))
    return free_thread_provider