MCPcopy
hub / github.com/celery/celery / connection_or_acquire

Method connection_or_acquire

celery/app/base.py:1077–1087  ·  view source on GitHub ↗

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

(self, connection=None, pool=True, *_, **__)

Source from the content-addressed store, hash-verified

1075 return self.connection_for_write()
1076
1077 def connection_or_acquire(self, connection=None, pool=True, *_, **__):
1078 """Context used to acquire a connection from the pool.
1079
1080 For use within a :keyword:`with` statement to get a connection
1081 from the pool if one is not already provided.
1082
1083 Arguments:
1084 connection (kombu.Connection): If not provided, a connection
1085 will be acquired from the connection pool.
1086 """
1087 return FallbackContext(connection, self._acquire_connection, pool=pool)
1088
1089 default_connection = connection_or_acquire # XXX compat
1090

Callers 5

test_regular_taskMethod · 0.80
moveFunction · 0.80
purgeMethod · 0.80
broadcastMethod · 0.80

Calls 1

FallbackContextClass · 0.90

Tested by 2

test_regular_taskMethod · 0.64