From: Michael Fladischer Date: Sun, 20 Sep 2026 13:49:35 +0000 Subject: Add docstrings to click subcommands. Fixes #1148092, as click-man expects each command and sub-command to have a docstring. --- celery/bin/amqp.py | 28 ++++++++++++++++++++++++++++ celery/bin/logtool.py | 15 +++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/celery/bin/amqp.py b/celery/bin/amqp.py index b42b1da..ded9d09 100644 --- a/celery/bin/amqp.py +++ b/celery/bin/amqp.py @@ -88,6 +88,9 @@ def amqp(ctx): @click.pass_obj def exchange_declare(amqp_context, exchange, type, passive, durable, auto_delete): + """ + Declare an exchange on the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -112,6 +115,9 @@ def exchange_declare(amqp_context, exchange, type, passive, durable, type=bool) @click.pass_obj def exchange_delete(amqp_context, exchange, if_unused): + """ + Delete an exchange on the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -135,6 +141,9 @@ def exchange_delete(amqp_context, exchange, if_unused): type=str) @click.pass_obj def queue_bind(amqp_context, queue, exchange, routing_key): + """ + Bind an exchange to a queue using a routing key. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -164,6 +173,9 @@ def queue_bind(amqp_context, queue, exchange, routing_key): default=False) @click.pass_obj def queue_declare(amqp_context, queue, passive, durable, auto_delete): + """ + Declare a queue in the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -194,6 +206,9 @@ def queue_declare(amqp_context, queue, passive, durable, auto_delete): default=False) @click.pass_obj def queue_delete(amqp_context, queue, if_unused, if_empty): + """ + Delete a queue in the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -217,6 +232,9 @@ def queue_delete(amqp_context, queue, if_unused, if_empty): type=str) @click.pass_obj def queue_purge(amqp_context, queue): + """ + Purge all messages from a queue on the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -241,6 +259,10 @@ def queue_purge(amqp_context, queue): default=False) @click.pass_obj def basic_get(amqp_context, queue, no_ack): + """ + Synchonously polls the AMQP broker for a message in a queue, and retrieves + the message if a message is in the queue. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -271,6 +293,9 @@ def basic_get(amqp_context, queue, no_ack): @click.pass_obj def basic_publish(amqp_context, msg, exchange, routing_key, mandatory, immediate): + """ + Publishes a message to an exchange on the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() @@ -296,6 +321,9 @@ def basic_publish(amqp_context, msg, exchange, routing_key, mandatory, type=int) @click.pass_obj def basic_ack(amqp_context, delivery_tag): + """ + Acknowledge a delivery tag to the AMQP broker. + """ if amqp_context.channel is None: amqp_context.echo_error('Not connected to broker. Please retry...') amqp_context.reconnect() diff --git a/celery/bin/logtool.py b/celery/bin/logtool.py index ae64c3e..f50ad8c 100644 --- a/celery/bin/logtool.py +++ b/celery/bin/logtool.py @@ -121,6 +121,9 @@ def logtool(ctx): @click.argument('files', nargs=-1) @click.pass_context def stats(ctx, files): + """ + Read log files and output report. + """ ctx.obj.echo(REPORT_FORMAT.format( **Audit().run(files).report() )) @@ -130,6 +133,9 @@ def stats(ctx, files): @click.argument('files', nargs=-1) @click.pass_context def traces(ctx, files): + """ + Read log files and output tracebacks. + """ Audit(on_trace=ctx.obj.echo).run(files) @@ -137,6 +143,9 @@ def traces(ctx, files): @click.argument('files', nargs=-1) @click.pass_context def errors(ctx, files): + """ + Read log files and output error messages. + """ Audit(on_task_error=lambda line, *_: ctx.obj.echo(line)).run(files) @@ -144,6 +153,9 @@ def errors(ctx, files): @click.argument('files', nargs=-1) @click.pass_context def incomplete(ctx, files): + """ + Read log files and output incomplete tasks. + """ audit = Audit() audit.run(files) for task_id in audit.incomplete_tasks(): @@ -154,4 +166,7 @@ def incomplete(ctx, files): @click.argument('files', nargs=-1) @click.pass_context def debug(ctx, files): + """ + Read log files and output debug messages. + """ Audit(on_debug=ctx.obj.echo).run(files)