def task_worker(task): """Runs the actual function in separate thread.""" function = task._metadata['function'] args = task._metadata['args'] kwargs = task._metadata['kwargs'] results = execute(function, args, kwargs) task.set_results(results)
def worker_process(params, channel): """The worker process routines.""" signal(SIGINT, SIG_IGN) if params.initializer is not None: if not run_initializer(params.initializer, params.initargs): os._exit(1) try: for task in worker_get_next_task(channel, params.task_limit): payload = task.payload results = execute(payload.function, payload.args, payload.kwargs) send_results(channel, Results(task.id, results)) except (EOFError, EnvironmentError) as error: os._exit(error.errno)
def task_worker(pipe, function, args, kwargs): """Runs the actual function in separate process.""" results = execute(function, args, kwargs) send_results(pipe, results)
def execute_next_task(task): function, args, kwargs = task return execute(function, args, kwargs)
def execute_next_task(task): function, args, kwargs = task._metadata task._timestamp = time.time() results = execute(function, args, kwargs) task.set_results(results)
def execute_next_task(task): parameters = task._metadata task._timestamp = time.time() results = execute(parameters.function, parameters.args, parameters.kwargs) task.set_results(results)