MCPcopy
hub / github.com/celery/celery / inspect

Function inspect

celery/bin/control.py:178–208  ·  view source on GitHub ↗

Inspect the workers by sending them the COMMAND inspect command. Availability: RabbitMQ (AMQP) and Redis transports.

(ctx, command, timeout, destination, json, **kwargs)

Source from the content-addressed store, hash-verified

176@click.pass_context
177@handle_preload_options
178def inspect(ctx, command, timeout, destination, json, **kwargs):
179 """Inspect the workers by sending them the COMMAND inspect command.
180
181 Availability: RabbitMQ (AMQP) and Redis transports.
182 """
183 _verify_command_name('inspect', command)
184 callback = None if json else partial(_say_remote_command_reply, ctx,
185 show_reply=True)
186 arguments = _compile_arguments(command, ctx.args)
187 inspect = ctx.obj.app.control.inspect(timeout=timeout,
188 destination=destination,
189 callback=callback)
190 try:
191 replies = inspect._request(command, **arguments)
192 except Exception as exc:
193 handle_remote_command_error(f'inspect {command}', exc)
194
195 if not replies:
196 raise CeleryCommandException(
197 message='No nodes replied within time constraint',
198 exit_code=EX_UNAVAILABLE
199 )
200
201 if json:
202 ctx.obj.echo(dumps(replies))
203 return
204
205 nodecount = len(replies)
206 if not ctx.obj.quiet:
207 ctx.obj.echo('\n{} {} online.'.format(
208 nodecount, text.pluralize(nodecount, 'node')))
209
210
211@click.command(cls=CeleryCommand,

Callers

nothing calls this directly

Calls 8

_verify_command_nameFunction · 0.85
_compile_argumentsFunction · 0.85
_requestMethod · 0.80
echoMethod · 0.80
inspectMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…