예제 #1
0
파일: process.py 프로젝트: Jason916/pebble
 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)
예제 #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)
예제 #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)
예제 #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
예제 #5
0
파일: process.py 프로젝트: noxdafox/pebble
    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
예제 #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