def _start_process(self, target, args): """Call `target` with `args` in a separate process. The result of the call is returned via `self._q`. Args: target (callable): Function to call in new process. args (it): Tuple/list of arguments to pass to `target`. """ def _wrapper(): """Closure around the callable.""" result = target(*args) self._q.put(result) proc = Process(target=_wrapper, name='Process#{}'.format(self._counter)) proc.start() print('{} started.'.format(proc.name)) proc.start_time = time.time() self.pool.append(proc) self._counter += 1