MCPcopy
hub / github.com/celery/celery / producer_or_acquire

Method producer_or_acquire

celery/app/base.py:1091–1103  ·  celery/app/base.py::Celery.producer_or_acquire

Context used to acquire a producer from the pool. For use within a :keyword:`with` statement to get a producer from the pool if one is not already provided Arguments: producer (kombu.Producer): If not provided, a producer will be acquired from th

(self, producer=None)

Source from the content-addressed store, hash-verified

1089 default_connection = connection_or_acquire class="cm"># XXX compat
1090
1091 def producer_or_acquire(self, producer=None):
1092 class="st">"""Context used to acquire a producer from the pool.
1093
1094 For use within a :keyword:`with` statement to get a producer
1095 from the pool if one is not already provided
1096
1097 Arguments:
1098 producer (kombu.Producer): If not provided, a producer
1099 will be acquired from the producer pool.
1100 class="st">"""
1101 return FallbackContext(
1102 producer, self.producer_pool.acquire, block=True,
1103 )
1104
1105 default_producer = producer_or_acquire class="cm"># XXX compat
1106

Callers 8

send_taskMethod · 0.95
test_taskMethod · 0.80
bench_applyFunction · 0.80
_producerMethod · 0.80
electionMethod · 0.80
_apply_tasksMethod · 0.80
apply_asyncMethod · 0.80
groupFunction · 0.80

Calls 1

FallbackContextClass · 0.90

Tested by 1

test_taskMethod · 0.64