MCPcopy Create free account
hub / github.com/celery/celery / Backend

Class Backend

celery/backends/base.py:198–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198class Backend:
199 READY_STATES = states.READY_STATES
200 UNREADY_STATES = states.UNREADY_STATES
201 EXCEPTION_STATES = states.EXCEPTION_STATES
202
203 TimeoutError = TimeoutError
204
205 #: Time to sleep between polling each individual item
206 #: in `ResultSet.iterate`. as opposed to the `interval`
207 #: argument which is for each pass.
208 subpolling_interval = None
209
210 #: If true the backend must implement :meth:`get_many`.
211 supports_native_join = False
212
213 #: If true the backend must automatically expire results.
214 #: The daily backend_cleanup periodic task won't be triggered
215 #: in this case.
216 supports_autoexpire = False
217
218 #: Set to true if the backend is persistent by default.
219 persistent = True
220
221 #: If true the backend can store a result payload that has been
222 #: compressed, which means storing and returning arbitrary bytes
223 #: unchanged. Backends that put the payload inside a JSON document, or
224 #: that decode it to text on the way out, can't, and the
225 #: :setting:`result_compression` setting is ignored for them.
226 supports_result_compression = False
227
228 #: If true the backend applies :setting:`result_failure_expires` to the
229 #: results of failed tasks.
230 supports_failure_expires = False
231
232 retry_policy = {
233 'max_retries': 20,
234 'interval_start': 0,
235 'interval_step': 1,
236 'interval_max': 1,
237 }
238
239 def __init__(self, app,
240 serializer=None, max_cached_results=None, accept=None,
241 expires=None, expires_type=None, url=None, **kwargs):
242 self.app = app
243 conf = self.app.conf
244 self.serializer = serializer or conf.result_serializer
245 (self.content_type,
246 self.content_encoding,
247 self.encoder) = serializer_registry._encoders[self.serializer]
248 self.compression = self.prepare_compression(
249 conf.get('result_compression'))
250 cmax = max_cached_results or conf.result_cache_max
251 self._cache = _nulldict() if cmax == -1 else LRUCache(limit=cmax)
252
253 self.expires = self.prepare_expires(expires, expires_type)
254
255 # precedence: accept, conf.result_accept_content, conf.accept_content

Callers 3

_make_consumerFunction · 0.90
get_drainerMethod · 0.90
test_date_doneMethod · 0.90

Calls

no outgoing calls

Tested by 3

_make_consumerFunction · 0.72
get_drainerMethod · 0.72
test_date_doneMethod · 0.72