示例#1
0
 def on_task_call(self, producer, task_id):
     # Called every time a task is sent when using this backend.
     # We declare the queue we receive replies on in advance of sending
     # the message, but we skip this if running in the prefork pool
     # (task_join_will_block), as we know the queue is already declared.
     if not task_join_will_block():
         maybe_declare(self.binding(producer.channel), retry=True)
示例#2
0
文件: rpc.py 项目: Liu0330/zufang
 def on_task_call(self, producer, task_id):
     # Called every time a task is sent when using this backend.
     # We declare the queue we receive replies on in advance of sending
     # the message, but we skip this if running in the prefork pool
     # (task_join_will_block), as we know the queue is already declared.
     if not task_join_will_block():
         maybe_declare(self.binding(producer.channel), retry=True)
示例#3
0
def denied_join_result():
    reset_value = task_join_will_block()
    _set_task_join_will_block(True)
    try:
        yield
    finally:
        _set_task_join_will_block(reset_value)
示例#4
0
def allow_join_result():
    reset_value = task_join_will_block()
    _set_task_join_will_block(False)
    try:
        yield
    finally:
        _set_task_join_will_block(reset_value)
示例#5
0
 def test_task_join_will_block(self):
     prev, _state._task_join_will_block = _state._task_join_will_block, 0
     try:
         self.assertEqual(_state._task_join_will_block, 0)
         _state._set_task_join_will_block(True)
         print(_state.task_join_will_block)
         self.assertTrue(_state.task_join_will_block())
     finally:
         _state._task_join_will_block = prev
示例#6
0
 def test_task_join_will_block(self):
     prev, _state._task_join_will_block = _state._task_join_will_block, 0
     try:
         self.assertEqual(_state._task_join_will_block, 0)
         _state._set_task_join_will_block(True)
         print(_state.task_join_will_block)
         self.assertTrue(_state.task_join_will_block())
     finally:
         _state._task_join_will_block = prev
示例#7
0
文件: redis.py 项目: xyzonline/celery
 def on_task_call(self, producer, task_id):
     if not task_join_will_block():
         self.result_consumer.consume_from(task_id)
示例#8
0
 def on_task_call(self, producer, task_id):
     if not task_join_will_block():
         self.result_consumer.consume_from(task_id)
示例#9
0
文件: rpc.py 项目: bryson/celery
 def on_task_call(self, producer, task_id):
     if not task_join_will_block():
         maybe_declare(self.binding(producer.channel), retry=True)
示例#10
0
文件: rpc.py 项目: tgwizard/celery
 def on_task_call(self, producer, task_id):
     if not task_join_will_block():
         maybe_declare(self.binding(producer.channel), retry=True)
示例#11
0
def assert_will_not_block():
    if task_join_will_block():
        raise RuntimeError(E_WOULDBLOCK)