MCPcopy
hub / github.com/celery/celery / get

Method get

celery/result.py:190–261  ·  view source on GitHub ↗

Wait until task is ready, and return its result. Warning: Waiting for tasks within a task may lead to deadlocks. Please read :ref:`task-synchronous-subtasks`. Warning: Backends use resources to store and transmit results. To ensure that r

(self, timeout=None, propagate=True, interval=0.5,
            no_ack=True, follow_parents=True, callback=None, on_message=None,
            on_interval=None, disable_sync_subtasks=True,
            EXCEPTION_STATES=states.EXCEPTION_STATES,
            PROPAGATE_STATES=states.PROPAGATE_STATES)

Source from the content-addressed store, hash-verified

188 reply=wait, timeout=timeout)
189
190 def get(self, timeout=None, propagate=True, interval=0.5,
191 no_ack=True, follow_parents=True, callback=None, on_message=None,
192 on_interval=None, disable_sync_subtasks=True,
193 EXCEPTION_STATES=states.EXCEPTION_STATES,
194 PROPAGATE_STATES=states.PROPAGATE_STATES):
195 """Wait until task is ready, and return its result.
196
197 Warning:
198 Waiting for tasks within a task may lead to deadlocks.
199 Please read :ref:`task-synchronous-subtasks`.
200
201 Warning:
202 Backends use resources to store and transmit results. To ensure
203 that resources are released, you must eventually call
204 :meth:`~@AsyncResult.get` or :meth:`~@AsyncResult.forget` on
205 EVERY :class:`~@AsyncResult` instance returned after calling
206 a task.
207
208 Arguments:
209 timeout (float): How long to wait, in seconds, before the
210 operation times out. This is the setting for the publisher
211 (celery client) and is different from `timeout` parameter of
212 `@app.task`, which is the setting for the worker. The task
213 isn't terminated even if timeout occurs.
214 propagate (bool): Re-raise exception if the task failed.
215 interval (float): Time to wait (in seconds) before retrying to
216 retrieve the result. Note that this does not have any effect
217 when using the RPC/redis result store backends, as they don't
218 use polling.
219 no_ack (bool): Enable amqp no ack (automatically acknowledge
220 message). If this is :const:`False` then the message will
221 **not be acked**.
222 follow_parents (bool): Re-raise any exception raised by
223 parent tasks.
224 disable_sync_subtasks (bool): Disable tasks to wait for sub tasks
225 this is the default configuration. CAUTION do not enable this
226 unless you must.
227
228 Raises:
229 celery.exceptions.TimeoutError: if `timeout` isn't
230 :const:`None` and the result does not arrive within
231 `timeout` seconds.
232 Exception: If the remote call raised an exception then that
233 exception will be re-raised in the caller process.
234 """
235 if self.ignored:
236 return
237
238 if disable_sync_subtasks:
239 assert_will_not_block()
240 _on_interval = promise()
241 if follow_parents and propagate and self.parent:
242 _on_interval = promise(self._maybe_reraise_parent_error, weak=True)
243 self._maybe_reraise_parent_error()
244 if on_interval:
245 _on_interval.then(on_interval)
246
247 if self._cache:

Calls 6

maybe_throwMethod · 0.95
assert_will_not_blockFunction · 0.85
thenMethod · 0.45
add_pending_resultMethod · 0.45
wait_for_pendingMethod · 0.45