o
    wvXje  ã                   @   s8   d Z ddlmZmZ ddlmZ dZG dd„ deƒZdS )zAThe ``celery migrate`` command, used to filter and move messages.é    )Úabsolute_importÚunicode_literals)ÚCommandzGMigrating task {state.count}/{state.strtotal}: {body[task]}[{body[id]}]c                   @   s0   e Zd ZdZdZeZdd„ Zdd„ Zdd„ Z	d	S )
Úmigratean  Migrate tasks from one broker to another.

    Warning:
        This command is experimental, make sure you have a backup of
        the tasks before you continue.

    Example:
        .. code-block:: console

            $ celery migrate amqp://A.example.com amqp://guest@B.example.com//
            $ celery migrate redis://localhost amqp://guest@localhost//
    z<source_url> <dest_url>c                 C   s|   |  d¡}|jddtdd� |jddtdd	d
� |jdddddd� |jdddd� |jdddd� |jdddddd� d S )NzMigration Optionsz--limitz-nz Number of tasks to consume (int))ÚtypeÚhelpz	--timeoutz-tg      ð?z,Timeout in seconds (float) waiting for tasks)r   Údefaultr   z--ack-messagesz-aÚ
store_trueFz Ack messages from source broker.)Úactionr   r   z--tasksz-Tz List of task names to filter on.)r   z--queuesz-QzList of queues to migrate.z	--foreverz-Fz'Continually migrate tasks until killed.)Úadd_argument_groupÚadd_argumentÚintÚfloat)ÚselfÚparserÚgroup© r   úO/var/www/html/myproject/venv/lib/python3.10/site-packages/celery/bin/migrate.pyÚadd_arguments   s2   
þþþþþ
þzmigrate.add_argumentsc                 C   s   |   | jj||d�¡ d S )N)ÚstateÚbody)ÚoutÚprogress_fmtÚformat)r   r   r   Úmessager   r   r   Úon_migrate_task8   s   zmigrate.on_migrate_taskc                 K   s<   ddl m} ddlm} |||ƒ||ƒfd| ji|¤Ž d S )Nr   )Ú
Connection)Úmigrate_tasksÚcallback)Úkombur   Úcelery.contrib.migrater   r   )r   ÚsourceÚdestinationÚkwargsr   r   r   r   r   Úrun;   s   ÿþ
ýzmigrate.runN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚargsÚMIGRATE_PROGRESS_FMTr   r   r   r$   r   r   r   r   r      s    r   N)r(   Ú
__future__r   r   Úcelery.bin.baser   r*   r   r   r   r   r   Ú<module>   s
    