File: //usr/local/lib/python3.9/site-packages/celery/worker/consumer/__pycache__/consumer.cpython-39.pyc
a
X>h�u � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ ddlmZmZ dd lmZ dd
lmZ ddlmZ ddlmZmZ dd
lmZmZ ddlmZ ddl m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1m2Z2 ddl3m4Z4 ddl5m6Z6m7Z7m8Z8m9Z9m:Z: dZ;ej<Z<ej=Z=e<e=hZ>e)e?�Z@e@jAe@jBe@jCe@jDe@jEf\ZAZBZFZDZGdZHdZIdZJdZKdZLdZMdZNd ZOd!ZPd"ZQd#ZRd$d%� ZSG d&d'� d'�ZTG d(d)� d)ejU�ZVdS )*z�Worker Consumer Blueprint.
This module contains the components responsible for consuming messages
from the broker, processing the messages and keeping the broker connections
up and running.
� N)�defaultdict)�sleep)�
restart_state)�RestartFreqExceeded)� DummyLock)�ContentDisallowed�DecodeError)�_detect_environment)� safe_repr)�TokenBucket)�ppartial�promise)� bootsteps�signals)�build_tracer)�CPendingDeprecationWarning�InvalidTaskError�
NotRegistered�WorkerShutdown�WorkerTerminate)�noop)�
get_logger)�gethostname)�Bunch)�truncate)�humanize_seconds�rate)�loops)�active_requests�maybe_shutdown�requests�reserved_requests�
task_reserved)�Consumer�Evloop� dump_bodyzMconsumer: Connection to broker lost. Trying to re-establish the connection...z0Trying again {when}... ({retries}/{max_retries})z'consumer: Cannot connect to %s: %s.
%s
zWill retry using next failover.zkReceived and deleted unknown message. Wrong destination?!?
The full contents of the message body was: %s
a� Received unregistered task of type %s.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you're using relative imports?
Please see
https://docs.celeryq.dev/en/latest/internals/protocol.html
for more information.
The full contents of the message body was:
%s
The full contents of the message headers:
%s
The delivery info for this task is:
%s
a
Received invalid task message: %s
The message has been ignored and discarded.
Please ensure your message conforms to the task
message protocol as described here:
https://docs.celeryq.dev/en/latest/internals/protocol.html
The full contents of the message body was:
%s
zICan't decode message body: %r [type:%r encoding:%r headers:%s]
body: %s
zTbody: {0}
{{content_type:{1} content_encoding:{2}
delivery_info:{3} headers={4}}}
z}Task %s cannot be acknowledged after a connection loss since late acknowledgement is enabled for it.
Terminating it instead.
a�
In Celery 5.1 we introduced an optional breaking change which
on connection loss cancels all currently executed tasks with late acknowledgement enabled.
These tasks cannot be acknowledged as the connection is gone, and the tasks are automatically redelivered
back to the queue. You can enable this behavior using the worker_cancel_long_running_tasks_on_connection_loss
setting. In Celery 5.1 it is set to False by default. The setting will be set to True by default in Celery 6.0.
c C s. |du r| j n|}d�tt|�d�t| j ��S )z+Format message body for debugging purposes.Nz{} ({}b)i )�body�formatr r
�len)�mr&