This document describes the current stable version of Celery (5.2). For development docs, go here.
This module can be used to diagnose and sample the memory usage used by parts of your application.
For example, to sample the memory usage of calling tasks you can do this:
from celery.utils.debug import sample_mem, memdump from tasks import add try: for i in range(100): for j in range(100): add.delay(i, j) sample_mem() finally: memdump()
Utilities for debugging memory usage, blocking calls, etc.
Sample RSS memory usage.
Statistics can then be output by calling
Dump memory statistics.
sample(x, n, k=0)¶
Given a list x a sample of length
nof that list is returned.
For example, if n is 10, and x has 100 items, a list of every tenth. item is returned.
kcan be used as offset.
Return RSS memory usage as a humanized string.