U
    Z+d[                     @   s   d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ej
edededejd	d
eedddejddeedddejddeddddejddedddejddedddejddeddddejed d! ZdS )"zAThe ``celery migrate`` command, used to filter and move messages.    N)
Connection)CeleryCommandCeleryOptionhandle_preload_options)migrate_tasks)clssourcedestinationz-nz--limitzMigration OptionszNumber of tasks to consume.)r   type
help_grouphelpz-tz	--timeoutz%Timeout in seconds waiting for tasks.z-az--ack-messagesTz Ack messages from source broker.)r   Zis_flagr   r   z-Tz--tasksz List of task names to filter on.)r   r   r   z-Qz--queueszList of queues to migrate.z-Fz	--foreverz'Continually migrate tasks until killed.c                    s.    fdd}t t|t|fd|i| dS )zMigrate tasks from one broker to another.

    Warning:

        This command is experimental, make sure you have a backup of
        the tasks before you continue.
    c                    s&    j d| j d| j d|  d S )NzMigrating task /z: )objZechocountZstrtotal)statebodymessagectx 6/tmp/pip-unpacked-wheel-ucduq0nd/celery/bin/migrate.pyon_migrate_task:   s    z migrate.<locals>.on_migrate_taskcallbackN)r   r   )r   r   r	   kwargsr   r   r   r   migrate
   s    0r   )__doc__ZclickZkombur   Zcelery.bin.baser   r   r   Zcelery.contrib.migrater   commandargumentoptionintfloatZpass_contextr   r   r   r   r   <module>   sd   
