Inspect the workers by sending them the COMMAND inspect command. Availability: RabbitMQ (AMQP) and Redis transports.
(ctx, command, timeout, destination, json, **kwargs)
| 176 | @click.pass_context |
| 177 | @handle_preload_options |
| 178 | def 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, |
nothing calls this directly
no test coverage detected
searching dependent graphs…