MCPcopy
hub / github.com/Koed00/django-q / count_group_cached

Function count_group_cached

django_q/tasks.py:371–386  ·  view source on GitHub ↗

Count the results in a group in the cache backend

(group_id, failures=False, broker=None)

Source from the content-addressed store, hash-verified

369
370
371def count_group_cached(group_id, failures=False, broker=None):
372 """
373 Count the results in a group in the cache backend
374 """
375 if not broker:
376 broker = get_broker()
377 group_list = broker.cache.get(f"{broker.list_key}:{group_id}:keys")
378 if group_list:
379 if not failures:
380 return len(group_list)
381 failure_count = 0
382 for task_key in group_list:
383 task = SignedPackage.loads(broker.cache.get(task_key))
384 if not task["success"]:
385 failure_count += 1
386 return failure_count
387
388
389def delete_group(group_id, tasks=False, cached=Conf.CACHED):

Callers 3

result_group_cachedFunction · 0.85
fetch_group_cachedFunction · 0.85
count_groupFunction · 0.85

Calls 3

get_brokerFunction · 0.90
getMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected