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

Method join_native

celery/result.py:866–903  ·  view source on GitHub ↗

Backend optimized version of :meth:`join`. .. versionadded:: 2.2 Note that this does not support collecting the results for different task types using different backends. This is currently only supported by the amqp, Redis and cache result backends.

(self, timeout=None, propagate=True,
                    interval=0.5, callback=None, no_ack=True,
                    on_message=None, on_interval=None,
                    disable_sync_subtasks=True)

Source from the content-addressed store, hash-verified

864 )
865
866 def join_native(self, timeout=None, propagate=True,
867 interval=0.5, callback=None, no_ack=True,
868 on_message=None, on_interval=None,
869 disable_sync_subtasks=True):
870 """Backend optimized version of :meth:`join`.
871
872 .. versionadded:: 2.2
873
874 Note that this does not support collecting the results
875 for different task types using different backends.
876
877 This is currently only supported by the amqp, Redis and cache
878 result backends.
879 """
880 if disable_sync_subtasks:
881 assert_will_not_block()
882 order_index = None if callback else {
883 result.id: i for i, result in enumerate(self.results)
884 }
885 acc = None if callback else [None for _ in range(len(self))]
886 for task_id, meta in self.iter_native(timeout, interval, no_ack,
887 on_message, on_interval):
888 if isinstance(meta, list):
889 value = []
890 for children_result in meta:
891 value.append(children_result.get(
892 propagate=propagate,
893 disable_sync_subtasks=disable_sync_subtasks,
894 ))
895 else:
896 value = meta['result']
897 if propagate and meta['status'] in states.PROPAGATE_STATES:
898 raise value
899 if callback:
900 callback(task_id, value)
901 else:
902 acc[order_index[task_id]] = value
903 return acc
904
905 def _iter_meta(self, **kwargs):
906 return (meta for _, meta in self.backend.get_many(

Calls 4

iter_nativeMethod · 0.95
assert_will_not_blockFunction · 0.85
callbackFunction · 0.85
getMethod · 0.45