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/bin/migrate.py
"""The ``celery migrate`` command, used to filter and move messages."""
import click
from kombu import Connection

from celery.bin.base import CeleryCommand, CeleryOption, handle_preload_options
from celery.contrib.migrate import migrate_tasks


@click.command(cls=CeleryCommand)
@click.argument('source')
@click.argument('destination')
@click.option('-n',
              '--limit',
              cls=CeleryOption,
              type=int,
              help_group='Migration Options',
              help='Number of tasks to consume.')
@click.option('-t',
              '--timeout',
              cls=CeleryOption,
              type=float,
              help_group='Migration Options',
              help='Timeout in seconds waiting for tasks.')
@click.option('-a',
              '--ack-messages',
              cls=CeleryOption,
              is_flag=True,
              help_group='Migration Options',
              help='Ack messages from source broker.')
@click.option('-T',
              '--tasks',
              cls=CeleryOption,
              help_group='Migration Options',
              help='List of task names to filter on.')
@click.option('-Q',
              '--queues',
              cls=CeleryOption,
              help_group='Migration Options',
              help='List of queues to migrate.')
@click.option('-F',
              '--forever',
              cls=CeleryOption,
              is_flag=True,
              help_group='Migration Options',
              help='Continually migrate tasks until killed.')
@click.pass_context
@handle_preload_options
def migrate(ctx, source, destination, **kwargs):
    """Migrate tasks from one broker to another.

    Warning:

        This command is experimental, make sure you have a backup of
        the tasks before you continue.
    """
    # TODO: Use a progress bar
    def on_migrate_task(state, body, message):
        ctx.obj.echo(f"Migrating task {state.count}/{state.strtotal}: {body}")

    migrate_tasks(Connection(source),
                  Connection(destination),
                  callback=on_migrate_task,
                  **kwargs)