예제 #1
0
파일: tasks.py 프로젝트: alexming/DTC
def _sync(task):
    task_queue = Queue()
    result_queue = Queue()
    task = signing.SignedPackage.loads(pack)
    task_queue.put(task)
    task_queue.put('STOP')
    cluster.worker(task_queue, result_queue, Value('f', -1))
    result_queue.put('STOP')
    cluster.monitor(result_queue)
    return True, task['id']
예제 #2
0
파일: tasks.py 프로젝트: nikicat/django-q
def _sync(pack):
    """Simulate a package travelling through the cluster."""
    task_queue = Queue()
    result_queue = Queue()
    task = signing.SignedPackage.loads(pack)
    task_queue.put(task)
    task_queue.put('STOP')
    cluster.worker(task_queue, result_queue, Value('f', -1))
    result_queue.put('STOP')
    cluster.monitor(result_queue)
    return task['id']
예제 #3
0
def _sync(task_id, pack):
    """
    Simulates a package travelling through the cluster.

    """
    task_queue = Queue()
    result_queue = Queue()
    task_queue.put(pack)
    task_queue.put('STOP')
    cluster.worker(task_queue, result_queue, Value('b', -1))
    result_queue.put('STOP')
    cluster.monitor(result_queue)
    return task_id