Multiprocessing Worker - celery.worker

Utility functions

celery.utils.chunks(it, n)

Split an iterator into chunks with n elements each.

Examples

# n == 2 >>> x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 2) >>> list(x) [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10]]

# n == 3 >>> x = chunks(iter([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), 3) >>> list(x) [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10]]

celery.utils.gen_unique_id()

Generate a unique id, having - hopefully - a very small chance of collission.

For now this is provided by uuid.uuid4().

celery.utils.mitemgetter(*keys)
Like operator.itemgetter() but returns None on missing keys instead of raising KeyError.

Previous topic

Logging - celery.log

Next topic

Django Views - celery.views

This Page