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

Method task_result_exists

celery/backends/base.py:1394–1408  ·  view source on GitHub ↗

Check if a result exists in the backend for the given task ID. This overrides the base implementation to directly check for the existence of the key in the store, which is more accurate than checking the status since tasks stored with PENDING status would still be de

(self, task_id)

Source from the content-addressed store, hash-verified

1392 return self.decode_result(meta)
1393
1394 def task_result_exists(self, task_id):
1395 """Check if a result exists in the backend for the given task ID.
1396
1397 This overrides the base implementation to directly check for
1398 the existence of the key in the store, which is more accurate
1399 than checking the status since tasks stored with PENDING status
1400 would still be detected.
1401
1402 .. versionadded:: 5.7.0
1403
1404 Returns:
1405 bool: :const:`True` if the backend has a result for the task,
1406 :const:`False` otherwise.
1407 """
1408 return bool(self.get(self.get_key_for_task(task_id)))
1409
1410 def _restore_group(self, group_id):
1411 """Get task meta-data for a task by id."""

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
get_key_for_taskMethod · 0.95

Tested by

no test coverage detected