Esempio n. 1
0
    def __init__(self,
                 provider=LocalProvider(),
                 label='ipp',
                 working_dir=None,
                 controller=Controller(),
                 container_image=None,
                 engine_dir=None,
                 storage_access=None,
                 engine_debug_level=None,
                 workers_per_node=1,
                 managed=True):

        StatusHandlingExecutor.__init__(self, provider)
        self.label = label
        self.working_dir = working_dir
        self.controller = controller
        self.engine_debug_level = engine_debug_level
        self.container_image = container_image
        self.engine_dir = engine_dir
        self.workers_per_node = workers_per_node
        self.storage_access = storage_access
        self.managed = managed

        self.debug_option = ""
        if self.engine_debug_level:
            self.debug_option = "--log-level={}".format(
                self.engine_debug_level)
Esempio n. 2
0
    def __init__(
            self,
            label='LowLatencyExecutor',
            provider=LocalProvider(),
            launch_cmd=None,
            address="127.0.0.1",
            worker_port=None,
            worker_port_range=(54000, 55000),
            interchange_port_range=(55000, 56000),
            #  storage_access=None,
            working_dir=None,
            worker_debug=False,
            workers_per_node=1,
            #  cores_per_worker=1.0,
            managed=True):
        logger.debug("Initializing LowLatencyExecutor")

        StatusHandlingExecutor.__init__(self, provider)
        self.label = label
        self.launch_cmd = launch_cmd
        self.provider = provider
        self.worker_debug = worker_debug
        # self.storage_access = storage_access if storage_access is not None else []
        # if len(self.storage_access) > 1:
        # raise ConfigurationError('Multiple storage access schemes are not supported')
        self.working_dir = working_dir
        self.managed = managed
        self.blocks = []
        self.workers_per_node = workers_per_node

        self._task_counter = 0
        self.address = address
        self.worker_port = worker_port
        self.worker_port_range = worker_port_range
        self.interchange_port_range = interchange_port_range
        self.run_dir = '.'

        # TODO: add debugging, logdir, other functionality to workers
        if not launch_cmd:
            self.launch_cmd = """lowlatency_worker.py -n {workers_per_node} --task_url={task_url} --logdir={logdir}"""
Esempio n. 3
0
    def __init__(self,
                 label: str = 'HighThroughputExecutor',
                 provider: ExecutionProvider = LocalProvider(),
                 launch_cmd: Optional[str] = None,
                 address: Optional[str] = None,
                 worker_ports: Optional[Tuple[int, int]] = None,
                 worker_port_range: Optional[Tuple[int, int]] = (54000, 55000),
                 interchange_port_range: Optional[Tuple[int,
                                                        int]] = (55000, 56000),
                 storage_access: Optional[List[Staging]] = None,
                 working_dir: Optional[str] = None,
                 worker_debug: bool = False,
                 cores_per_worker: float = 1.0,
                 mem_per_worker: Optional[float] = None,
                 max_workers: Union[int, float] = float('inf'),
                 cpu_affinity: str = 'none',
                 prefetch_capacity: int = 0,
                 heartbeat_threshold: int = 120,
                 heartbeat_period: int = 30,
                 poll_period: int = 10,
                 address_probe_timeout: Optional[int] = None,
                 managed: bool = True,
                 worker_logdir_root: Optional[str] = None):

        logger.debug("Initializing HighThroughputExecutor")

        StatusHandlingExecutor.__init__(self, provider)
        self.label = label
        self.launch_cmd = launch_cmd
        self.worker_debug = worker_debug
        self.storage_access = storage_access
        self.working_dir = working_dir
        self.managed = managed
        self.blocks = {}  # type: Dict[str, str]
        self.cores_per_worker = cores_per_worker
        self.mem_per_worker = mem_per_worker
        self.max_workers = max_workers
        self.prefetch_capacity = prefetch_capacity
        self.address = address
        self.address_probe_timeout = address_probe_timeout
        if self.address:
            self.all_addresses = address
        else:
            self.all_addresses = ','.join(get_all_addresses())

        mem_slots = max_workers
        cpu_slots = max_workers
        if hasattr(self.provider, 'mem_per_node') and \
                self.provider.mem_per_node is not None and \
                mem_per_worker is not None and \
                mem_per_worker > 0:
            mem_slots = math.floor(self.provider.mem_per_node / mem_per_worker)
        if hasattr(self.provider, 'cores_per_node') and \
                self.provider.cores_per_node is not None:
            cpu_slots = math.floor(self.provider.cores_per_node /
                                   cores_per_worker)

        self.workers_per_node = min(max_workers, mem_slots, cpu_slots)
        if self.workers_per_node == float('inf'):
            self.workers_per_node = 1  # our best guess-- we do not have any provider hints

        self._task_counter = 0
        self.hub_address = None  # set to the correct hub address in dfk
        self.hub_port = None  # set to the correct hub port in dfk
        self.worker_ports = worker_ports
        self.worker_port_range = worker_port_range
        self.interchange_port_range = interchange_port_range
        self.heartbeat_threshold = heartbeat_threshold
        self.heartbeat_period = heartbeat_period
        self.poll_period = poll_period
        self.run_dir = '.'
        self.worker_logdir_root = worker_logdir_root
        self.cpu_affinity = cpu_affinity

        if not launch_cmd:
            self.launch_cmd = ("process_worker_pool.py {debug} {max_workers} "
                               "-a {addresses} "
                               "-p {prefetch_capacity} "
                               "-c {cores_per_worker} "
                               "-m {mem_per_worker} "
                               "--poll {poll_period} "
                               "--task_port={task_port} "
                               "--result_port={result_port} "
                               "--logdir={logdir} "
                               "--block_id={{block_id}} "
                               "--hb_period={heartbeat_period} "
                               "{address_probe_timeout_string} "
                               "--hb_threshold={heartbeat_threshold} "
                               "--cpu-affinity {cpu_affinity} ")
Esempio n. 4
0
    def __init__(
        self,
        label="HighThroughputExecutor",
        # NEW
        strategy=SimpleStrategy(),
        max_workers_per_node=float("inf"),
        mem_per_worker=None,
        launch_cmd=None,
        # Container specific
        worker_mode="no_container",
        scheduler_mode="hard",
        container_type=None,
        container_cmd_options="",
        cold_routing_interval=10.0,
        # Tuning info
        prefetch_capacity=10,
        provider=LocalProvider(),
        address="127.0.0.1",
        worker_ports=None,
        worker_port_range=(54000, 55000),
        interchange_port_range=(55000, 56000),
        storage_access=None,
        working_dir=None,
        worker_debug=False,
        cores_per_worker=1.0,
        heartbeat_threshold=120,
        heartbeat_period=30,
        poll_period=10,
        container_image=None,
        suppress_failure=True,
        run_dir=None,
        endpoint_id=None,
        managed=True,
        interchange_local=True,
        passthrough=True,
        funcx_service_address=None,
        task_status_queue=None,
    ):
        log.debug("Initializing HighThroughputExecutor")
        StatusHandlingExecutor.__init__(self, provider)

        self.label = label
        self.launch_cmd = launch_cmd
        self.worker_debug = worker_debug
        self.max_workers_per_node = max_workers_per_node

        # NEW
        self.strategy = strategy
        self.cores_per_worker = cores_per_worker
        self.mem_per_worker = mem_per_worker

        # Container specific
        self.scheduler_mode = scheduler_mode
        self.container_type = container_type
        self.container_cmd_options = container_cmd_options
        self.cold_routing_interval = cold_routing_interval

        # Tuning info
        self.prefetch_capacity = prefetch_capacity

        self.storage_access = storage_access if storage_access is not None else []
        if len(self.storage_access) > 1:
            raise ConfigurationError(
                "Multiple storage access schemes are not supported")
        self.working_dir = working_dir
        self.managed = managed
        self.blocks = []
        self.cores_per_worker = cores_per_worker
        self.endpoint_id = endpoint_id
        self._task_counter = 0
        self.address = address
        self.worker_ports = worker_ports
        self.worker_port_range = worker_port_range
        self.interchange_port_range = interchange_port_range
        self.heartbeat_threshold = heartbeat_threshold
        self.heartbeat_period = heartbeat_period
        self.poll_period = poll_period
        self.suppress_failure = suppress_failure
        self.run_dir = run_dir
        self.queue_proc = None
        self.interchange_local = interchange_local
        self.passthrough = passthrough
        self.task_status_queue = task_status_queue

        # FuncX specific options
        self.funcx_service_address = funcx_service_address
        self.container_image = container_image
        self.worker_mode = worker_mode
        self.last_response_time = time.time()

        if not launch_cmd:
            self.launch_cmd = ("process_worker_pool.py {debug} {max_workers} "
                               "-c {cores_per_worker} "
                               "--poll {poll_period} "
                               "--task_url={task_url} "
                               "--result_url={result_url} "
                               "--logdir={logdir} "
                               "--hb_period={heartbeat_period} "
                               "--hb_threshold={heartbeat_threshold} "
                               "--mode={worker_mode} "
                               "--container_image={container_image} ")

        self.ix_launch_cmd = ("funcx-interchange {debug} -c={client_address} "
                              "--client_ports={client_ports} "
                              "--worker_port_range={worker_port_range} "
                              "--logdir={logdir} "
                              "{suppress_failure} ")