Skip to content

Instantly share code, notes, and snippets.

View robin-vjc's full-sized avatar

Robin Vujanic robin-vjc

View GitHub Profile
@robin-vjc
robin-vjc / batches.py
Created November 18, 2020 13:01
Updated batches.py (for Celery 5+)
# -*- coding: utf-8 -*-
"""
celery.contrib.batches
======================
Experimental task class that buffers messages and processes them as a list.
.. warning::
For this to work you have to set
:setting:`CELERYD_PREFETCH_MULTIPLIER` to zero, or some value where
the final multiplied value is higher than ``flush_every``.
In the future we hope to add the ability to direct batching tasks