Skip to content

climate_ref_celery.serialisation #

Registration of the REF wire format with kombu.

Celery looks codecs up by name, so this has to be imported by both the client sending a task and the worker receiving it. Importing climate_ref_celery.app is enough for both.

register_serialisation() #

Register the REF wire format so Celery can encode tasks and results with it

Safe to call more than once.

Source code in packages/climate-ref-celery/src/climate_ref_celery/serialisation.py
def register_serialisation() -> None:
    """
    Register the REF wire format so Celery can encode tasks and results with it

    Safe to call more than once.
    """
    register(
        SERIALIZER,
        encoder=_encode,
        decoder=_decode,
        content_type=CONTENT_TYPE,
        content_encoding="utf-8",
    )