示例#1
0
文件: pool.py 项目: villind/pebble
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):
            results = execute_next_task(task.payload)
            send_results(channel, Results(task.id, results))
    except (EOFError, EnvironmentError) as error:
        os._exit(error.errno)
示例#2
0
def task_worker(pipe, function, args, kwargs):
    """Runs the actual function in separate process."""
    results = execute(function, args, kwargs)
    send_results(pipe, results)