Return the :class:`kombu.Queue` being a direct route to a worker. Arguments: hostname (str, ~kombu.Queue): The fully qualified node name of a worker (e.g., ``w1@example.com``). If passed a :class:`kombu.Queue` instance it will simply return that inst
(hostname: str | Queue)
| 36 | |
| 37 | |
| 38 | def worker_direct(hostname: str | Queue) -> Queue: |
| 39 | """Return the :class:`kombu.Queue` being a direct route to a worker. |
| 40 | |
| 41 | Arguments: |
| 42 | hostname (str, ~kombu.Queue): The fully qualified node name of |
| 43 | a worker (e.g., ``w1@example.com``). If passed a |
| 44 | :class:`kombu.Queue` instance it will simply return |
| 45 | that instead. |
| 46 | """ |
| 47 | if isinstance(hostname, Queue): |
| 48 | return hostname |
| 49 | return Queue( |
| 50 | WORKER_DIRECT_QUEUE_FORMAT.format(hostname=hostname), |
| 51 | WORKER_DIRECT_EXCHANGE, |
| 52 | hostname, |
| 53 | ) |
| 54 | |
| 55 | |
| 56 | def nodename(name: str, hostname: str) -> str: |