Esempio n. 1
0
 def new_worker(self):
     try:
         worker = launch_process(
             worker_process, self.worker_parameters, self.workers_channel)
         self.workers[worker.pid] = worker
     except (OSError, EnvironmentError) as error:
         raise BrokenProcessPool(error)
Esempio n. 2
0
 def new_worker(self):
     try:
         worker = launch_process(
             worker_process, self.worker_parameters, self.workers_channel)
         self.workers[worker.pid] = worker
     except (OSError, EnvironmentError) as error:
         raise BrokenProcessPool(error)
Esempio n. 3
0
 def new_worker(self):
     try:
         worker = launch_process(WORKERS_NAME, worker_process, False,
                                 self.mp_context, self.worker_parameters,
                                 self.workers_channel)
         self.workers[worker.pid] = worker
     except (OSError, EnvironmentError) as error:
         raise BrokenProcessPool(error)
Esempio n. 4
0
    def wrapper(*args, **kwargs):
        future = ProcessFuture()
        reader, writer = Pipe(duplex=False)

        if get_start_method() != 'fork':
            target = _trampoline
            args = [function.__name__, function.__module__] + list(args)
        else:
            target = function

        worker = launch_process(_function_handler, target, args, kwargs,
                                writer)

        writer.close()

        future.set_running_or_notify_cancel()

        launch_thread(_worker_handler, future, worker, reader, timeout)

        return future
Esempio n. 5
0
    def wrapper(*args, **kwargs):
        future = ProcessFuture()
        reader, writer = Pipe(duplex=False)

        if get_start_method() != 'fork':
            target = _trampoline
            args = [function.__name__, function.__module__] + list(args)
        else:
            target = function

        worker = launch_process(
            _function_handler, target, args, kwargs, writer)

        writer.close()

        future.set_running_or_notify_cancel()

        launch_thread(_worker_handler, future, worker, reader, timeout)

        return future
Esempio n. 6
0
    def wrapper(*args, **kwargs):
        future = ProcessFuture()
        reader, writer = mp_context.Pipe(duplex=False)

        if start_method != 'fork':
            target = _trampoline
            args = [_qualname(function), function.__module__] + list(args)
        else:
            target = function

        worker = launch_process(name, _function_handler, daemon, mp_context,
                                target, args, kwargs, (reader, writer))

        writer.close()

        future.set_running_or_notify_cancel()

        launch_thread(name, _worker_handler, True, future, worker, reader,
                      timeout)

        return future