HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/celery/app/__pycache__/base.cpython-39.pyc
a

X>h|��
@s,dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZddl
m
Z
ddl
mZddlmZddlmZddlmZdd	lmZmZdd
lmZddlmZddlmZdd
lm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ddl4m5Z5m6Z6ddl7m8Z8ddl9m:Z:m;Z;ddl<m=Z=ddl>m?Z?ddl@mAZAddlBmCZCmDZDmEZEddlFmGZGmHZHmIZIddlJmKZKddlLmMZMmNZNddlOmPZPmZmQZQddlRmSZSmTZTmUZUdd lVmWZWd!d"lXmYZYmZZZd!d#l[m\Z]d!d$l^m_Z_d!d%l`maZambZbd!d&lcmdZdd!d'lemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnejo�r�dd(lpmqZqd)ZreKes�Ztd*hZuejv�wd+�Zxd,Zyd-d.�Zzd/d0�Z{d1d2�Z|d<d4ej}d5ej~fee�ej�ej�eej~fej�ej�eej~fd6�d7d8�Z�Gd9d:�d:e
e?�Z�Gd;d4�d4�Z�e�Z�dS)=z#Actual App instance implementation.�N)�UserDict�defaultdict�deque)�datetime)�timezone��
attrgetter)�Exit)�isoparse)�Exchange�pools)�LamportClock��oid_from)�calculate_routing_key)�register_after_fork)�cached_property)�uuid)�starpromise)�	platforms�signals)	�_announce_app_finalized�_deregister_app�
_register_app�_set_current_app�_task_stack�connect_on_app_finalize�get_current_app�get_current_worker_task�set_default_app)�AlwaysEagerIgnored�ImproperlyConfigured)�get_loader_cls)�PromiseProxy�maybe_evaluate)�abstract)�AttributeDictMixin)�Signal)�first�
head_from_fun�
maybe_list)�
gen_task_name�instantiate�symbol_by_name)�
get_logger)�FallbackContext�
mro_lookup)�maybe_make_awarer�to_utc�)�annotation_is_class�annotation_issubclass�get_optional_arg)�detect_quorum_queues�)�backends�builtins)�prepare)�add_autoretry_behaviour)�DEFAULT_SECURITY_DIGEST�find_deprecated_settings)�TaskRegistry)	�
AppPickler�Settings�_new_key_to_old�_old_key_to_new�
_unpickle_app�_unpickle_app_v2�appstr�	bugreport�detect_settings)�	BaseModel)�Celeryzcelery.fixups.django:fixupZFORKED_BY_MULTIPROCESSINGz�
The environment variable {0!r} is not set,
and as such the configuration could not be loaded.

Please set this variable and make sure it points to
a valid configuration module.

Example:
    {0}="proj.celeryconfig"
cCst|j|tthtgd�S)z�Return true if app has customized method `attr`.

    Note:
        This is used for optimizations in cases where we know
        how the default behavior works, but need to account
        for someone using inheritance to override a method/property.
    )�stopZmonkey_patched)r0�	__class__rJ�object�__name__)�app�attr�rQ�9/usr/local/lib/python3.9/site-packages/celery/app/base.py�app_has_customMs�rScCst��|�|�S)z
Unpickle app.)r�	_rgetattr)Zreverse_name�argsrQrQrR�_unpickle_appattrYsrVc
CsFz|��Wn4ty@}ztjd|dd�WYd}~n
d}~00dS)Nz!after forker raised exception: %rr8)�exc_info)�_after_fork�	Exception�logger�info)rO�excrQrQrR�_after_fork_cleanup_app`sr]TrJ.)rO�task_fun�	task_name�strict�context�dump_kwargsc	
s�zt�d�}Wn.ty<}ztd�|�WYd}~n
d}~00|j��durPi��dur\i���dd�t����t�	����������fdd��}|S)zIWrapper to validate arguments and serialize return values using Pydantic.�pydanticzAYou need to install pydantic to use pydantic model serialization.N�mode�jsonc
s��j|i|��}|j��D]^\}}�j|j}t|�}|durJ|durJ|}t|��r|j|�i����d��d�|j|<q�|ji|j	��}�j
}t|�}	|	dur�|	}t|�r�t|��r�t||�r�|j
fi���S|S)N)Z
celery_appZcelery_task_name)r`ra)�bind�	arguments�items�
parameters�
annotationr6r5Zmodel_validaterU�kwargs�return_annotationr4�
isinstanceZ
model_dump)
Z	task_argsZtask_kwargsZ
bound_argsZarg_name�	arg_valueZarg_annotationZoptional_argZreturned_valuerlZoptional_return_annotation�rIrOrarbr`r^r_Ztask_signaturerQrR�wrapper�s2
����z!pydantic_wrapper.<locals>.wrapper)
�	importlib�
import_module�ModuleNotFoundErrorr!rI�
setdefault�inspect�	signature�	functools�wraps)	rOr^r_r`rarbrc�exrprQrorR�pydantic_wrapperis	 
$rzc@s`eZdZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Ze
dd��ZdS)�PendingConfigurationNcCs t�|d|�t�|d|�dS)N�_data�callback)rM�__setattr__)�self�confr}rQrQrR�__init__�szPendingConfiguration.__init__cCs||j|<dS�N�r|�r�key�valuerQrQrR�__setitem__�sz PendingConfiguration.__setitem__cCs|j��dSr�)r|�clear�rrQrQrRr��szPendingConfiguration.clearcOs|jj|i|��dSr�)r|�update�rrUrkrQrQrRr��szPendingConfiguration.updatecOs|jj|i|��Sr�)r|rtr�rQrQrRrt�szPendingConfiguration.setdefaultcCs
||jvSr�r�)rr�rQrQrR�__contains__�sz!PendingConfiguration.__contains__cCs
t|j�Sr�)�len�datar�rQrQrR�__len__�szPendingConfiguration.__len__cCs
t|j�Sr�)�reprr�r�rQrQrR�__repr__�szPendingConfiguration.__repr__cCs|��Sr�)r}r�rQrQrRr��szPendingConfiguration.data)rN�
__module__�__qualname__r}r|r�r�r�r�rtr�r�r�rr�rQrQrQrRr{�sr{c@seZdZdZeZejZejej	ZZ	dZ
dZdZe
ZdZdZdZdZdZdZdZdZdZdZdZdZd	ZdZdZdZdZd�dd�Z d
d�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'd�dd�Z(d�dd�Z)dd �Z*d�d!d"�Z+d�e,e,e-j.e-j/e0e-j1fe-j.e-j/e0e-j1fd#�d$d%�Z2d&d'�Z3d(d)�Z4d�d*d+�Z5d,d-�Z6d�d.d/�Z7d�d0d1�Z8d�d3d4�Z9ddddde:d5fd6d7�Z;d�d9d:�Z<d;d<�Z=d=d>�Z>d?d@�Z?d�dBdC�Z@d�dDdE�ZAd�dFdG�ZBd�dHdI�ZCd�dJdK�ZDeCZEd�dLdM�ZFd�dNdO�ZGeGZHd�dPdQ�ZIeIZJdRdS�ZKdTdU�ZLd�dVdW�ZMdXdY�ZNdZd[�ZOd\d]�ZPd^d_�ZQd`da�ZRdbdc�ZSddde�ZTd�dgdh�ZUd�didj�ZVd�dkdl�ZWdmdn�ZXd�dpdq�ZYdrds�ZZdtdu�Z[dvdw�Z\dxdy�Z]dzd{�Z^d|d}�Z_d~d�Z`d�d��Zaebd�d���Zcebd�d���Zdebd�d���Zeebd�d���Zfebd�d���Zgebd�d���Zhebd�d���Ziebd�d���Zjekd�d���Zlekd�d���Zmekd�d���Znebd�d���Zoekd�d���Zpebd�d���Zqekd�d���Zrerjsd�d���Zrekd�d���Ztekd�d���Zueujsd�d���Zuebd�d���Zvebd�d���Zwebd�d���Zxebd�d���Zyebd�d���Zzebd�d���Z{ekd�d���Z|d�d��Z}ebd�d���Z~dS)�rJa�Celery application.

    Arguments:
        main (str): Name of the main module if running as `__main__`.
            This is used as the prefix for auto-generated task names.

    Keyword Arguments:
        broker (str): URL of the default broker used.
        backend (Union[str, Type[celery.backends.base.Backend]]):
            The result store backend class, or the name of the backend
            class to use.

            Default is the value of the :setting:`result_backend` setting.
        autofinalize (bool): If set to False a :exc:`RuntimeError`
            will be raised if the task registry or tasks are used before
            the app is finalized.
        set_as_current (bool):  Make this the global current app.
        include (List[str]): List of modules every worker should import.

        amqp (Union[str, Type[AMQP]]): AMQP object or class name.
        events (Union[str, Type[celery.app.events.Events]]): Events object or
            class name.
        log (Union[str, Type[Logging]]): Log object or class name.
        control (Union[str, Type[celery.app.control.Control]]): Control object
            or class name.
        tasks (Union[str, Type[TaskRegistry]]): A task registry, or the name of
            a registry class.
        fixups (List[str]): List of fix-up plug-ins (e.g., see
            :mod:`celery.fixups.django`).
        config_source (Union[str, class]): Take configuration from a class,
            or object.  Attributes may include any settings described in
            the documentation.
        task_cls (Union[str, Type[celery.app.task.Task]]): base task class to
            use. See :ref:`this section <custom-task-cls-app-wide>` for usage.
    Nzcelery.app.amqp:AMQPzcelery.app.events:Eventszcelery.app.log:Loggingzcelery.app.control:Controlzcelery.app.task:Taskz celery.app.registry:TaskRegistryFTcs:t���_d�_t��_|�_|p&�j�_|p2�j�_|p@��	��_
|pL�j�_|pX�j�_t
|�px�jtuoxt�jd��_|p��j�_|�_t�j��_tt��_tt��_|�_|�_|�_d�_|
�_t��_ t��_!d�_"t�#��_$t��_%|	�_&t'�j&t(��s���j&�pi��_&t)�d��_*|�p0i�_+t��_,��-d|
���-d|���-d|�|�.�D]\}}��-||��qht/t0�j+�j1��jt2t3fd��_4|du�r�t�j5�n|�_6�fdd	��j6D��_7�j�r��8��j9du�r�t:d
d��_9t:dd
hd��_;t:dd��_<t:dd��_=d�_>��?�t@��dS)N�task_clsF�__reduce_args__Z
broker_url�result_backend�include)�prefix�keyscsg|]}t|����qSrQ)r-)�.0�fixupr�rQrR�
<listcomp>r�z#Celery.__init__.<locals>.<listcomp>zapp.on_configure��namezapp.on_after_configure�source)r�Zproviding_argszapp.on_after_finalizezapp.on_after_fork)A�	threading�local�_local�_backend_cacher
Zclock�main�amqp_cls�
events_cls�_get_default_loader�
loader_cls�log_cls�control_cls�boolrLrJ�hasattrZ_custom_task_cls_usedr��set_as_currentr-�registry_clsr�set�user_options�steps�autofinalize�	namespace�
strict_typing�
configured�_config_sourcer�_pending_defaults�_pending_periodic_tasks�	finalized�RLock�_finalize_mutex�_pending�_tasksrmr?rS�_using_v1_reduce�_preconf�_preconf_set_by_auto�_Celery__autosetrhrAr{�_finalize_pending_confrCrB�_conf�builtin_fixups�fixups�_fixups�set_current�on_configurer'�on_after_configure�on_after_finalize�
on_after_forkZuse_fast_trace_task�on_initr)rr��loader�backend�amqp�events�log�controlr��tasksZbrokerr��changes�
config_sourcer�r�r�r�r�rkr�r�rQr�rRr�,sx
�


���zCelery.__init__cCstj�d�p|jpdS)NZ
CELERY_LOADERzcelery.loaders.app:AppLoader)�os�environ�getr�r�rQrQrRr��s
��zCelery._get_default_loadercCsdS)z!Optional callback called at init.NrQr�rQrQrRr��szCelery.on_initcCs"|dur||j|<|j�|�dSr�)r�r��addr�rQrQrRZ	__autoset�s
zCelery.__autosetcCst|�dS)z*Make this the current app for this thread.N)rr�rQrQrRr��szCelery.set_currentcCst|�dS)z*Make this the default app for all threads.N)rr�rQrQrR�set_default�szCelery.set_defaultcCs"|jsd|_tdurt|t�dS)NT)�_after_fork_registeredrr]r�rQrQrR�_ensure_after_fork�szCelery._ensure_after_forkcCsd|_t|�dS)aOClean up after the application.

        Only necessary for dynamically created apps, and you should
        probably use the :keyword:`with` statement instead.

        Example:
            >>> with Celery(set_as_current=False) as app:
            ...     with app.connection_for_write() as conn:
            ...         pass
        N)�_poolrr�rQrQrR�close�szCelery.closec
Cs�ddlm}||jd_|dur&tj}z\z|j|dd�Wn8tyr}z |jWYd}~Wd|jd_Sd}~00Wd|jd_nd|jd_0dS)zgRun :program:`celery` using `argv`.

        Uses :data:`sys.argv` if `argv` is not specified.
        r)�celeryNF)rUZstandalone_mode)	Zcelery.bin.celeryr��params�default�sys�argvr�r	Z	exit_code)rr�r��erQrQrR�start�s�zCelery.startcCs.|durtj}d|vrtd��|j|d�dS)znRun :program:`celery worker` using `argv`.

        Uses :data:`sys.argv` if `argv` is not specified.
        NZworkerzkThe worker sub-command must be specified in argv.
Use app.start() to programmatically start other commands.)r�)r�r��
ValueErrorr�)rr�rQrQrR�worker_main�s�zCelery.worker_maincs�tr.|�dd�r.ddlm}||ddi|��Sd�fdd�	}t|�dkrnt|d	�rf|fi|��|�Std
��|r�td�tt|�t|�g����|fi|��S)
a�Decorator to create a task class out of any callable.

        See :ref:`Task options<task-options>` for a list of the
        arguments that can be passed to this decorator.

        Examples:
            .. code-block:: python

                @app.task
                def refresh_feed(url):
                    store_feed(feedparser.parse(url))

            with setting extra options:

            .. code-block:: python

                @app.task(exchange='feeds')
                def refresh_feed(url):
                    return store_feed(feedparser.parse(url))

        Note:
            App Binding: For custom apps the task decorator will return
            a proxy object, so that the act of creating the task is not
            performed until the task is used or the task registry is accessed.

            If you're depending on binding to be deferred, then you must
            not access any attributes on the returned object until the
            application is fully set up (finalized).
        �lazyTr8)�shared_taskFNcs|������fdd�}|S)Ncsr�r"��fdd�}�j|_t|��r,�jr@�j�fi���}n"t�j�f��jd�}�j�|��rn�|�S|S)Ncs|j�fi���Sr�)�_task_from_fun�rO)�fun�optsrQrR�consszRCelery.task.<locals>.inner_create_task_cls.<locals>._create_task_cls.<locals>.cons)�__doc__)rNrr�r�r#r�r��append)r�r��ret)�_filtr�r�r�shared)r�rR�_create_task_clss
�zDCelery.task.<locals>.inner_create_task_cls.<locals>._create_task_clsrQ)r��filterr�r�r�r�)r�r�r�r�rR�inner_create_task_cls�sz*Celery.task.<locals>.inner_create_task_clsrz(argument 1 to @task() must be a callablez+@task() takes exactly 1 argument ({} given))TNT)	�USING_EXECVr��r�r��callable�	TypeError�format�sum)rrUr�r�r�rQr�rR�task�s��zCelery.taskcCstt||d��S)N��bound)�staticmethodr))rr�rrQrQrR�type_checker szCelery.type_checker)rc�pydantic_strict�pydantic_context�pydantic_dump_kwargsc	Ks�|js|jstd��|p&|�|j|j�}|p0|j}||jvr�|durVt||||||�}|r^|nt	|�}
t
|j|ft|||
d|j|j|j
|j||d�|
d�	fi|	����}z|j|_Wnty�Yn0||j|j<|�|�t|fi|	��n
|j|}|S)N�"Contract breach: app not finalizedTr�)	rOr��runZ
_decoratedr�r��__annotations__Z
__header__�__wrapped__)r�r��RuntimeErrorr+rNr��Taskr�rzr�type�dictr�rrr��AttributeErrorr�rfr<)rr�r��baserfrcrrr�optionsrr�rQrQrRr�#s<

�	�


zCelery._task_from_funcKsdt�|�r|�p|}|js4t|�}|�|j|j�|_t|fi|��||j|j<||_	|�
|�|S)z�Utility for registering a task-based class.

        Note:
            This is here for compatibility with old Celery 1.0
            style task classes, you should not need to use this for
            new projects.
        )ru�isclassr�rr+rNr�r<r��_apprf)rr�rr�rQrQrR�
register_taskPs�
zCelery.register_taskcCst|||�Sr�)r+)rr��modulerQrQrRr+cszCelery.gen_task_namecCs�|j�v|jsn|r |js td��d|_t|�|j}|rFt|���q4|j�	�D]}|�
|�qP|jj|d�Wd�n1s�0YdS)z�Finalize the app.

        This loads built-in tasks, evaluates pending task decorators,
        reads configuration, etc.
        rT��senderN)
r�r�r�r
rr�r$�popleftr��valuesrfr��send)r�auto�pendingr�rQrQrR�finalizefs
zCelery.finalizecs>t|�s|�fdd��}|jr.|j�|��S|j�|�dS)adAdd default configuration from dict ``d``.

        If the argument is a callable function then it will be regarded
        as a promise, and it won't be loaded until the configuration is
        actually needed.

        This method can be compared to:

        .. code-block:: pycon

            >>> celery.conf.update(d)

        with a difference that 1) no copy will be made and 2) the dict will
        not be transferred when the worker spawns child processes, so
        it's important that the same configuration happens at import time
        when pickle restores the object on the other side.
        cs�Sr�rQrQ��drQrR�<lambda>�r�z%Celery.add_defaults.<locals>.<lambda>N)r�r�r��add_defaultsr�r�)rr�rQrrRr |s
zCelery.add_defaultscCs<||_|p|j|_|s|jr8d|_|jj||d�r8|jSdS)aRead configuration from object.

        Object is either an actual object or the name of a module to import.

        Example:
            >>> celery.config_from_object('myapp.celeryconfig')

            >>> from myapp import celeryconfig
            >>> celery.config_from_object(celeryconfig)

        Arguments:
            silent (bool): If true then import errors will be ignored.
            force (bool): Force reading configuration immediately.
                By default the configuration will be read only when required.
        N)�silent)r�r�r�r�r��config_from_objectr�)r�objr!�forcer�rQrQrRr"�s
zCelery.config_from_objectcCs:tj�|�}|s*|rdStt���|���|j|||d�S)a3Read configuration from environment variable.

        The value of the environment variable must be the name
        of a module to import.

        Example:
            >>> os.environ['CELERY_CONFIG_MODULE'] = 'myapp.celeryconfig'
            >>> celery.config_from_envvar('CELERY_CONFIG_MODULE')
        F)r!r$)r�r�r�r!�ERR_ENVVAR_NOT_SET�stripr�r")rZ
variable_namer!r$�module_namerQrQrR�config_from_envvar�s
�zCelery.config_from_envvarr�cCs|j�|j�||��dSr�)r�r�r�Zcmdline_config_parser)rr�r�rQrQrR�config_from_cmdline�s�zCelery.config_from_cmdlinerec	
Cs$ddlm}|||||||||d�S)a;Setup the message-signing serializer.

        This will affect all application instances (a global operation).

        Disables untrusted serializers and if configured to use the ``auth``
        serializer will register the ``auth`` serializer with the provided
        settings into the Kombu serializer registry.

        Arguments:
            allowed_serializers (Set[str]): List of serializer names, or
                content_types that should be exempt from being disabled.
            key (str): Name of private key file to use.
                Defaults to the :setting:`security_key` setting.
            key_password (bytes): Password to decrypt the private key.
                Defaults to the :setting:`security_key_password` setting.
            cert (str): Name of certificate file to use.
                Defaults to the :setting:`security_certificate` setting.
            store (str): Directory containing certificates.
                Defaults to the :setting:`security_cert_store` setting.
            digest (str): Digest algorithm used when signing messages.
                Default is ``sha256``.
            serializer (str): Serializer used to encode messages after
                they've been signed.  See :setting:`task_serializer` for
                the serializers supported.  Default is ``json``.
        r)�setup_securityr�)Zcelery.securityr*)	rZallowed_serializersr��key_password�cert�store�digest�
serializerr*rQrQrRr*�s
�zCelery.setup_securityr�cCs0|r|�||�Stjjt|j||�d|d�dS)a�Auto-discover task modules.

        Searches a list of packages for a "tasks.py" module (or use
        related_name argument).

        If the name is empty, this will be delegated to fix-ups (e.g., Django).

        For example if you have a directory layout like this:

        .. code-block:: text

            foo/__init__.py
               tasks.py
               models.py

            bar/__init__.py
                tasks.py
                models.py

            baz/__init__.py
                models.py

        Then calling ``app.autodiscover_tasks(['foo', 'bar', 'baz'])`` will
        result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.

        Arguments:
            packages (List[str]): List of packages to search.
                This argument may also be a callable, in which case the
                value returned is used (for lazy evaluation).
            related_name (Optional[str]): The name of the module to find.  Defaults
                to "tasks": meaning "look for 'module.tasks' for every
                module in ``packages``.".  If ``None`` will only try to import
                the package, i.e. "look for 'module'".
            force (bool): By default this call is lazy so that the actual
                auto-discovery won't happen until an application imports
                the default modules.  Forcing will cause the auto-discovery
                to happen immediately.
        F)ZweakrN)�_autodiscover_tasksrZimport_modules�connectr)r�packages�related_namer$rQrQrR�autodiscover_tasks�s(��zCelery.autodiscover_taskscKs|r|�||�S|�|�Sr�)�_autodiscover_tasks_from_names�_autodiscover_tasks_from_fixups)rr2r3rkrQrQrRr0szCelery._autodiscover_taskscCs|j�t|�r|�n||�Sr�)r�r4r�)rr2r3rQrQrRr5s�z%Celery._autodiscover_tasks_from_namescCs|jdd�|jD�|d�S)NcSs(g|] }t|d�r|��D]}|�qqS)r4)r�r4)r�r��pkgrQrQrRr�s
�z:Celery._autodiscover_tasks_from_fixups.<locals>.<listcomp>)r3)r5r�)rr3rQrQrRr6s

��z&Celery._autodiscover_tasks_from_fixupsrc0Ks�d}} |j}!|pt�}|p|}|	p(|!j}	|j}"|"jrHtjtd�dd�|�dd�}#|	�	||p`||||�}|j
jjj
j}$|s�|�rft||$�d�rf|�d�}%|%r�|%jjn|d	}&|%r�|%jn|d
}'|%r�|%jjn|d}(|&dk�rT|�rt|t�r�t|�}t|�|����}|�rf|dk�rftt|�|'�}'td
dd�})|�dd�|'|d
<|)|d<nt�d|(�d��|du�r�t|t ��r�t|�|����}*n*t|t��r�tt|��|����}*n|}*|*dk�r�t�|�d|*�d��d}*|*|d<|�r�|�sF|j!}|�rF|�s|j"j#�p|j"j$}|�s(|j"j$}|"j%�rF|�&d|j"j'�d��|!j(|||||||||||t)|
�t)|�|�pv|j*|||jj+||||f|#|d�|��}+|�dg�},|,D]}-|�|-��q�|�r�|!j,|dd�}|�-|��f}.|.j�.��:|#�s�|j/�0|.|�|!j1|.||+fi|��Wd�n1�s(0YWd�n1�sH0Y|
�p\|j2|�}/|#|/_3|�r�| �s�|j!d}} |�r�|�4|/�|/S)z�Send task by name.

        Supports the same arguments as :meth:`@-Task.apply_async`.

        Arguments:
            name (str): Name of task to call (e.g., `"tasks.add"`).
            result_cls (AsyncResult): Specify custom result class.
        Nz,task_always_eager has no effect on send_taskr3)�
stacklevel�
ignore_resultFr�queue�
exchange_type�routing_key�exchange�directZcelery_delayed_27Ztopic)rzADirect exchanges are not supported with native delayed delivery.
z� is a direct exchange but should be a topic exchange or a fanout exchange in order for native delayed delivery to work properly.
If quorum queues are used, this task may block the worker process until the ETA arrives.z% has an expiration date in the past (aJs ago).
We assume this is intended and so we have set the expiration date to 0 instead.
According to RabbitMQ's documentation:
"Setting the TTL to 0 causes messages to be expired upon reaching a queue unless they can be delivered to a consumer immediately."
If this was unintended, please check the code which published this task.Z
expiration�priority)r9�replaced_task_nesting�stamped_headers)Zauto_declareT)5r�r�routerr�Ztask_always_eager�warnings�warnr �popZroute�
producer_pool�connections�
connection�	transport�driver_typer7r�r=rr<r�rm�strr
r1�now�
total_secondsr�intrrZ�warningr�current_worker_task�request�root_id�idZtask_inherit_parent_priorityrtZ
delivery_infoZcreate_task_messager*�
thread_oidZtask_send_sent_eventZProducer�producer_or_acquireZ_reraise_as_library_errorsr�Zon_task_callZsend_task_message�AsyncResultZignoredZ	add_trail)0rr�rUrkZ	countdown�etaZtask_id�producerrHrBZ
result_cls�expiresZ	publisher�linkZ
link_errorZ
add_to_parentZgroup_idZgroup_index�retriesZchordZreply_toZ
time_limitZsoft_time_limitrRZ	parent_idZ
route_nameZshadow�chainZ	task_typer@r�parentZhave_parentr�r�r9rJr:r;r<Z
exchange_namer=Z	expires_s�messagerAZstamp�P�resultrQrQrR�	send_task#s�

���



�
��
��
��

�����V
zCelery.send_taskcKs|j|p|jjfi|��S)z|Establish connection used for consuming.

        See Also:
            :meth:`connection` for supported arguments.
        )�_connectionr�Zbroker_read_url�r�urlrkrQrQrR�connection_for_read�szCelery.connection_for_readcKs|j|p|jjfi|��S)z|Establish connection used for producing.

        See Also:
            :meth:`connection` for supported arguments.
        )rbr��broker_write_urlrcrQrQrR�connection_for_write�szCelery.connection_for_writec
Ks2|j|p|jjf||||||||	|
||d�|
��S)aCEstablish a connection to the message broker.

        Please use :meth:`connection_for_read` and
        :meth:`connection_for_write` instead, to convey the intent
        of use for this connection.

        Arguments:
            url: Either the URL or the hostname of the broker to use.
            hostname (str): URL, Hostname/IP-address of the broker.
                If a URL is used, then the other argument below will
                be taken from the URL instead.
            userid (str): Username to authenticate as.
            password (str): Password to authenticate with
            virtual_host (str): Virtual host to use (domain).
            port (int): Port to connect to.
            ssl (bool, Dict): Defaults to the :setting:`broker_use_ssl`
                setting.
            transport (str): defaults to the :setting:`broker_transport`
                setting.
            transport_options (Dict): Dictionary of transport specific options.
            heartbeat (int): AMQP Heartbeat in seconds (``pyamqp`` only).
            login_method (str): Custom login method to use (AMQP only).
            failover_strategy (str, Callable): Custom failover strategy.
            **kwargs: Additional arguments to :class:`kombu.Connection`.

        Returns:
            kombu.Connection: the lazy connection instance.
        )�userid�password�virtual_host�port�ssl�connect_timeoutrI�transport_options�	heartbeat�login_method�failover_strategy)rgr�rf)r�hostnamerhrirjrkrlrmrIrnrorprqrkrQrQrRrH�s!
���zCelery.connectionc
Ksv|j}|jj||p|j|p|j|p&|j|p.|j|p6|j|�d|�|
|pJ|j	|pR|j
t|jfi|	pbi��|�d|�d�S)NZbroker_use_sslZbroker_connection_timeout)rIrlrorprqrnrm)
r�r��
ConnectionZbroker_userZbroker_passwordZbroker_vhostZbroker_portZbroker_transport�eitherZbroker_login_methodZbroker_failover_strategyr
Zbroker_transport_options)rrdrhrirjrkrlrmrIrnrorprqrkr�rQrQrRrb�s*
����zCelery._connectioncCs|r|jjdd�S|��S)z)Helper for :meth:`connection_or_acquire`.T��block)�pool�acquirerg)rrwrQrQrR�_acquire_connectionszCelery._acquire_connectioncOst||j|d�S)aRContext used to acquire a connection from the pool.

        For use within a :keyword:`with` statement to get a connection
        from the pool if one is not already provided.

        Arguments:
            connection (kombu.Connection): If not provided, a connection
                will be acquired from the connection pool.
        )rw)r/ry)rrHrw�_�__rQrQrR�connection_or_acquires
zCelery.connection_or_acquirecCst||jjdd�S)aEContext used to acquire a producer from the pool.

        For use within a :keyword:`with` statement to get a producer
        from the pool if one is not already provided

        Arguments:
            producer (kombu.Producer): If not provided, a producer
                will be acquired from the producer pool.
        Tru)r/rFrx)rrXrQrQrRrUs

�zCelery.producer_or_acquirecCst|�S)z<Prepare configuration before it is merged with the defaults.)r>)r�crQrQrR�prepare_config,szCelery.prepare_configcCstt�tj��}|�|j�S)z/Return the current time and date as a datetime.)r2rrL�datetime_timezone�utc�
astimezoner)rZ
now_in_utcrQrQrRrL0sz
Celery.nowcCs|jj�|�S)zxSelect subset of queues.

        Arguments:
            queues (Sequence[str]): a list of queue names to keep.
        )r��queues�select)rr�rQrQrR�
select_queues5szCelery.select_queuescGstdtd|�t|jj|�g�S)z�Get key from configuration or use default values.

        Fallback to the value of a configuration key if none of the
        `*values` are true.
        N)r(rr�r�)rZdefault_key�defaultsrQrQrRrt=s�z
Celery.eithercCst|�S)z)Return information useful in bug reports.)rGr�rQrQrRrGGszCelery.bugreportcCs(t�|jp|jj|j�\}}|||d�S)N)rOrd)r9Zby_url�backend_clsr�r�r�)rr�rdrQrQrR�_get_backendKs
�zCelery._get_backendc
CsHz|��}|_Wn0tyB}zt|j�|�WYd}~n
d}~00|S)z�Get config value by key and finalize loading the configuration.

        Note:
            This is used by PendingConfiguration:
                as soon as you access a key the configuration is read.
        N)�_load_configr�rrsrU)rr��errrQrQrRr�Qs
"zCelery._finalize_pending_confcCs�t|jt�r|jj|d�n|��|jr8|j�|j�d|_t|�	|jj
�|j|j|j
d�}|jdurv|j�|�n||_|j}|r�|j�t|�����q�|j}|r�|��\}}|j|i|��q�|jj||jd�|jS)NrT)Zignore_keysr�)rr�)rmr�r'rr�r�r"r�rHr~r�r�r�r�r�Z	swap_withr�r r$rr��_add_periodic_taskr�)r�settingsZpending_defZpending_beatZperiodic_task_argsZperiodic_task_kwargsrQrQrRr�bs,�
zCelery._load_configc	Cs@d|_zd|jd_Wnttfy,Yn0|jj|d�dS)Nr�r)r��__dict__Z_producer_poolr�KeyErrorr�rr�rQrQrRrX�szCelery._after_forkcOs||d<|jj|i|��S)z:Return a new :class:`~celery.Signature` bound to this app.rO)�_canvasrvr�rQrQrRrv�szCelery.signaturerQc	KsR|j|||||fi|��\}}|jr6|j|||d�n|j�||fd|ig�|S)a
        Add a periodic task to beat schedule.

        Celery beat store tasks based on `sig` or `name` if provided. Adding the
        same signature twice make the second task override the first one. To
        avoid the override, use distinct `name` for them.
        r�r�)�_sig_to_periodic_task_entryr�r�r�r�)	r�schedule�sigrUrkr�r�r��entryrQrQrR�add_periodic_task�s	
��
zCelery.add_periodic_taskc	Ksd|sin|}t|tj�r$|�||�n|�|j||�}|p>t|�||j|j|jt	|j
fi|��d�fS)N)r�r�rUrkr)rmr%ZCallableSignature�clonervr�r�rUrkr
r)rr�r�rUrkr�r�rQrQrRr��s
��
�z"Celery._sig_to_periodic_task_entrycCs6|dur&||jjvr&t�d|�d��||jj|<dS)NzPeriodic task key='zl' shadowed a previous unnamed periodic task. Pass a name kwarg to add_periodic_task to silence this warning.)r�Z
beat_schedulerZrO)rr�r�r�rQrQrRr��s

�zCelery._add_periodic_taskcCs|j|jddddd�S)z+Create a base task class bound to this app.rrT)r��	attribute�keep_reducer%)�subclass_with_selfr�r�rQrQrR�create_task_cls�s�zCelery.create_task_clsrOc	s`t|�}�r�n|j��fdd�}t||if|j|jd�|��}|sL||d<t|pV|j|f|�S)a�Subclass an app-compatible class.

        App-compatible means that the class has a class attribute that
        provides the default app it should use, for example:
        ``class Foo: app = None``.

        Arguments:
            Class (type): The app-compatible class to subclass.
            name (str): Custom name for the target class.
            attribute (str): Name of the attribute holding the app,
                Default is 'app'.
            reverse (str): Reverse path to this object used for pickling
                purposes. For example, to get ``app.AsyncResult``,
                use ``"AsyncResult"``.
            keep_reduce (bool): If enabled a custom ``__reduce__``
                implementation won't be provided.
        cst�|��ffSr�)rVr�r���reverserQrR�
__reduce__�sz-Celery.subclass_with_self.<locals>.__reduce__)r�r�r�)r-rNr
r�r�r)	rZClassr�r�r�r��kwr��attrsrQr�rRr��s���zCelery.subclass_with_selfcCst|�|�Sr�r)r�pathrQrQrRrT�szCelery._rgetattrcCs|Sr�rQr�rQrQrR�	__enter__�szCelery.__enter__cGs|��dSr�)r�)rrWrQrQrR�__exit__�szCelery.__exit__cCsdt|�j�dt|��d�S)N�<� �>)rrNrFr�rQrQrRr��szCelery.__repr__cCs |jr|��St|j|��ffSr�)r��
__reduce_v1__rErL�__reduce_keys__r�rQrQrRr��szCelery.__reduce__cCst|j|jf|��fSr�)rDrL�Picklerr�r�rQrQrRr��s�zCelery.__reduce_v1__c
CsD|j|jr|jjn|j|j|j|j|j|j	|j
|j|j|j
|jd�S)zAKeyword arguments used to reconstruct the object when unpickling.)r�r�r�r�r�r�r�r�r�r�r�r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rQrQrRr��s�zCelery.__reduce_keys__c
Cs6|j|jr|jjni|j|j|j|j|j|j	d|j
f
S)z>Deprecated method, please use :meth:`__reduce_keys__` instead.F)r�r�r�r�r�r�r�r�r�r�r�r�rQrQrRr�s
�zCelery.__reduce_args__cCs
|�d�S)zNWorker application.

        See Also:
            :class:`~@Worker`.
        zcelery.apps.worker:Worker�r�r�rQrQrR�Workersz
Celery.WorkercKs
|�d�S)zUEmbeddable worker.

        See Also:
            :class:`~@WorkController`.
        zcelery.worker:WorkControllerr��rrkrQrQrR�WorkController szCelery.WorkControllercKs
|�d�S)zf:program:`celery beat` scheduler application.

        See Also:
            :class:`~@Beat`.
        zcelery.apps.beat:Beatr�r�rQrQrR�Beat)szCelery.BeatcCs|��S)zBase task class for this app.)r�r�rQrQrRr2szCelery.TaskcCst|jj�Sr�)�prepare_annotationsr�Ztask_annotationsr�rQrQrR�annotations7szCelery.annotationscCs
|�d�S)zgCreate new result instance.

        See Also:
            :class:`celery.result.AsyncResult`.
        zcelery.result:AsyncResultr�r�rQrQrRrV;szCelery.AsyncResultcCs
|�d�S)Nzcelery.result:ResultSetr�r�rQrQrR�	ResultSetDszCelery.ResultSetcCs
|�d�S)zmCreate new group result instance.

        See Also:
            :class:`celery.result.GroupResult`.
        zcelery.result:GroupResultr�r�rQrQrR�GroupResultHszCelery.GroupResultcCs:|jdur4|��|jj}t�|�tj|��|_|jS)z�Broker connection pool: :class:`~@pool`.

        Note:
            This attribute is not related to the workers concurrency pool.
        N)r�r�r�Zbroker_pool_limitrZ	set_limitrGrg)r�limitrQrQrRrwQs

zCelery.poolcCstjS)z2Instance of task being executed, or :const:`None`.)r�topr�rQrQrR�current_task_szCelery.current_taskcCst�S)z�The task currently being executed by a worker or :const:`None`.

        Differs from :data:`current_task` in that it's not affected
        by tasks calling other tasks directly, or eagerly.
        )rr�rQrQrRrPdszCelery.current_worker_taskcCst|dd�S)z+Universally unique identifier for this app.F��threadsrr�rQrQrR�oidmsz
Celery.oidcCs:z
|jjWSty4t|dd�|j_}|YS0dS)z*Per-thread unique identifier for this app.Tr�N)r�r�rr)rZnew_oidrQrQrRrTvs

zCelery.thread_oidcCst|j|d�S)z,AMQP related functionality: :class:`~@amqp`.r�)r,r�r�rQrQrRr�szCelery.amqpcCs|jdur|jSt|jdd�S)z�A reference to the backend object

        Uses self._backend_cache if it is thread safe.
        Otherwise, use self._local
        Nr�)r��getattrr�r�rQrQrR�_backend�s
zCelery._backendcCs|jr||_n||j_dS)z!Set the backend object on the appN)Zthread_safer�r�r�)rr�rQrQrRr��scCs|jdur|��|_|jS)zCurrent backend instance.N)r�r�r�rQrQrRr��s

zCelery.backendcCs|jdur|��|_|jS)zCurrent configuration.N)r�r�r�rQrQrRr��s

zCelery.confcCs
||_dSr�)r�)rrrQrQrRr��scCst|j|d�S)z#Remote control: :class:`~@control`.r�)r,r�r�rQrQrRr��szCelery.controlcCst|j|d�S)z0Consuming and sending events: :class:`~@events`.r�)r,r�r�rQrQrRr��sz
Celery.eventscCst|j�|d�S)zCurrent loader instance.r�)r"r�r�rQrQrRr��sz
Celery.loadercCst|j|d�S)zLogging: :class:`~@log`.r�)r,r�r�rQrQrRr��sz
Celery.logcCsddlm}|S)Nr)�canvas)r�r�)rr�rQrQrRr��szCelery._canvascCs|jdd�|jS)zoTask registry.

        Warning:
            Accessing this attribute will also auto-finalize the app.
        T)r)rr�r�rQrQrRr��szCelery.taskscCs|jjSr�)r�rFr�rQrQrRrF�szCelery.producer_poolcCs|jtjkS)z/Check if the application uses the UTC timezone.)rr�r�rQrQrR�uses_utc_timezone�szCelery.uses_utc_timezonecCs*|j}|js|jrtjStjSt�|j�S)z�Current timezone for this app.

        This is a cached property taking the time zone from the
        :setting:`timezone` setting.
        )r�rZ
enable_utcr�r�Zget_timezone)rr�rQrQrRr�szCelery.timezone)NNNNNNNTNNNNNNNTNT)N)N)F)NNFFFNN)F)FFN)FF)r�)Nr�F)NNNNNNNNNNNNNTNNrNNNNNNNNNNr)N)N)NNNNNNNNNNNN)NNNNNNNNNNN)T)NT)N)N)rQrQN)rQNN)N)NrONF)rNr�r�r�r@r�rZSYSTEMZIS_macOSZ
IS_WINDOWSr�r�r��BUILTIN_FIXUPSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr��typing�Optional�DictrK�Anyr�rr+rr r"r(r)r=r*r4r0r5r6rarergrHrbZbroker_connectionryr|Zdefault_connectionrUZdefault_producerr~rLr�rtrGr�r�r�rXrvr�r�r�r�r�rTr�r�r�r�r�r�r�rr�r�r�rr�rVr�r��propertyrwr�rPr�rTr�r��setterr�r�r�r�r�r�r�r�rFr�rrQrQrQrRrJ�st%�
]

H
��-
�


�
 �
.�


�
+�





#�
�

	�
#	


























	
)TNN)�r�rwrqrur�r�r�r�rC�collectionsrrrrrr�operatorrZclick.exceptionsr	Zdateutil.parserr
ZkomburrZkombu.clocksr
Zkombu.commonrZ'kombu.transport.native_delayed_deliveryrZkombu.utils.compatrZkombu.utils.objectsrZkombu.utils.uuidrZvinerr�rrZ
celery._staterrrrrrrrrZcelery.exceptionsr r!Zcelery.loadersr"Zcelery.localr#r$Zcelery.utilsr%Zcelery.utils.collectionsr&Zcelery.utils.dispatchr'Zcelery.utils.functionalr(r)r*Zcelery.utils.importsr+r,r-Zcelery.utils.logr.Zcelery.utils.objectsr/r0Zcelery.utils.timer1r2Zutils.annotationsr4r5r6Zutils.quorum_queuesr7r�r9r:r�r;r�Z	autoretryr<r�r=r>�registryr?�utilsr@rArBrCrDrErFrGrH�
TYPE_CHECKINGrcrI�__all__rNrZr�r�r�r�r%rSrVr]�Callabler�rKr�r�r�rzr{rJZApprQrQrQrR�<module>s�,,�
��@,