celery.bin.amqp

The celery amqp command.

class celery.bin.amqp.AMQPAdmin(\args, **kwargs*)[源代码]

The celery celery amqp utility.

class celery.bin.amqp.AMQShell(\args, **kwargs*)[源代码]

AMQP API Shell.

参数:
  • connect – Function used to connect to the server, must return connection object.
  • silent – If True, the commands won’t have annoying output not relevant when running in non-shell mode.
  • amqp

    Mapping of AMQP API commands and their Spec.

  • amqp = {u’queue.declare’: <celery.bin.amqp.Spec object at 0xd0da14c>, u’queue.purge’: <celery.bin.amqp.Spec object at 0xd0daccc>, u’exchange.delete’: <celery.bin.amqp.Spec object at 0xd0da22c>, u’basic.publish’: <celery.bin.amqp.Spec object at 0xd0da80c>, u’basic.ack’: <celery.bin.amqp.Spec object at 0xd0dafac>, u’exchange.declare’: <celery.bin.amqp.Spec object at 0xd0da7ac>, u’queue.delete’: <celery.bin.amqp.Spec object at 0xd0da70c>, u’queue.bind’: <celery.bin.amqp.Spec object at 0xd0da6cc>, u’basic.get’: <celery.bin.amqp.Spec object at 0xd0daf6c>}

  • builtins = {u’exit’: u’do_exit’, u’EOF’: u’do_exit’, u’help’: u’do_help’}

  • chan = None

  • completenames(text, \ignored*)[源代码]

    Return all commands starting with text, for tab-completion.

  • conn = None

  • counter = 1

  • default(line)[源代码]

  • dispatch(cmd, argline)[源代码]

    Dispatch and execute the command.

    Lookup order is: builtins -> amqp.

  • display_command_help(cmd, short=False)[源代码]

  • do_exit(\args*)[源代码]

    The ‘exit’ command.

  • do_help(\args*)[源代码]

  • get_amqp_api_command(cmd, arglist)[源代码]

    With a command name and a list of arguments, convert the arguments to Python values and find the corresponding method on the AMQP channel object.

    返回:tuple of (method, processed_args).
  • get_names()[源代码]

  • identchars = u’.’

  • inc_counter = count(2)

  • needs_reconnect = False

  • note(m)[源代码]

    Say something to the user. Disabled if silent.

  • onecmd(line)[源代码]

    Parse line and execute command.

  • parseline(line)[源代码]

    Parse input line.

    返回:tuple of three items: (command_name, arglist, original_line)
  • prompt None[源代码]

  • prompt_fmt = u’{self.counter}> ‘

  • respond(retval)[源代码]

    What to do with the return value of a command.

  • say(m)[源代码]

class celery.bin.amqp.Spec(\args, **kwargs*)[源代码]

AMQP Command specification.

Used to convert arguments to Python values and display various help and tooltips.

参数:
  • args – see args.
  • returns – see returns.
  • coerce(index, value)[源代码]

    Coerce value for argument at index.

  • format_arg(name, type, default_value=None)[源代码]

  • format_response(response)[源代码]

    Format the return value of this command in a human-friendly way.

  • format_signature()[源代码]

  • str_args_to_python(arglist)[源代码]

    Process list of string arguments to values according to spec.

    e.g:

    1. >>> spec = Spec([('queue', str), ('if_unused', bool)])
    2. >>> spec.str_args_to_python('pobox', 'true')
    3. ('pobox', True)

class celery.bin.amqp.amqp(app=None, get_app=None, no_color=False, stdout=None, stderr=None, quiet=False, on_error=None, on_usage_error=None)[源代码]

AMQP Administration Shell.

Also works for non-amqp transports (but not ones that store declarations in memory).

Examples:

  1. celery amqp
  2. start shell mode
  3. celery amqp help
  4. show list of commands
  5. celery amqp exchange.delete name
  6. celery amqp queue.delete queue
  7. celery amqp queue.delete queue yes yes