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

Method iter_native

celery/backends/asynchronous.py:241–271  ·  view source on GitHub ↗
(self, result, no_ack=True, **kwargs)

Source from the content-addressed store, hash-verified

239 self.result_consumer.buckets[result] = bucket
240
241 def iter_native(self, result, no_ack=True, **kwargs):
242 self._ensure_not_eager()
243
244 results = result.results
245 if not results:
246 raise StopIteration()
247
248 # we tell the result consumer to put consumed results
249 # into these buckets.
250 bucket = deque()
251 for node in results:
252 if not hasattr(node, '_cache'):
253 bucket.append(node)
254 elif node._cache:
255 bucket.append(node)
256 else:
257 self._collect_into(node, bucket)
258
259 for _ in self._wait_for_pending(result, no_ack=no_ack, **kwargs):
260 while bucket:
261 node = bucket.popleft()
262 if not hasattr(node, '_cache'):
263 yield node.id, node.children
264 else:
265 yield node.id, node._cache
266 while bucket:
267 node = bucket.popleft()
268 if not hasattr(node, '_cache'):
269 yield node.id, node.children
270 else:
271 yield node.id, node._cache
272
273 def add_pending_result(self, result, weak=False, start_drainer=True):
274 if start_drainer:

Callers

nothing calls this directly

Calls 3

_collect_intoMethod · 0.95
_wait_for_pendingMethod · 0.95
_ensure_not_eagerMethod · 0.45

Tested by

no test coverage detected