This document describes the current stable version of Celery (5.4). For development docs, go here.


Worker name utilities.

celery.utils.nodenames.anon_nodename(hostname: str | None = None, prefix: str = 'gen') str[source]

Return the nodename for this process (not a worker).

This is used for e.g. the origin task message field.

celery.utils.nodenames.default_nodename(hostname: str) str[source]

Return the default nodename for this process.

celery.utils.nodenames.gethostname() string

Return the current host name.

celery.utils.nodenames.host_format(s: str, host: str | None = None, name: str | None = None, **extra: dict) str[source]

Format host %x abbreviations.

celery.utils.nodenames.node_format(s: str, name: str, **extra: dict) str[source]

Format worker node name (

celery.utils.nodenames.nodename(name: str, hostname: str) str[source]

Create node name from name/hostname pair.

celery.utils.nodenames.nodesplit(name: str) tuple[None, str] | list[str][source]

Split node name into tuple of name/hostname.

celery.utils.nodenames.worker_direct(hostname: str | Queue) Queue[source]

Return the kombu.Queue being a direct route to a worker.


hostname (str, Queue) – The fully qualified node name of a worker (e.g., If passed a kombu.Queue instance it will simply return that instead.