Show list of workers that are online.
(ctx, timeout, destination, json, **kwargs)
| 127 | @click.pass_context |
| 128 | @handle_preload_options |
| 129 | def status(ctx, timeout, destination, json, **kwargs): |
| 130 | """Show list of workers that are online.""" |
| 131 | callback = None if json else partial(_say_remote_command_reply, ctx) |
| 132 | try: |
| 133 | replies = ctx.obj.app.control.inspect(timeout=timeout, |
| 134 | destination=destination, |
| 135 | callback=callback).ping() |
| 136 | except Exception as exc: |
| 137 | handle_remote_command_error('status', exc) |
| 138 | |
| 139 | if not replies: |
| 140 | raise CeleryCommandException( |
| 141 | message='No nodes replied within time constraint', |
| 142 | exit_code=EX_UNAVAILABLE |
| 143 | ) |
| 144 | |
| 145 | if json: |
| 146 | ctx.obj.echo(dumps(replies)) |
| 147 | nodecount = len(replies) |
| 148 | if not kwargs.get('quiet', False): |
| 149 | ctx.obj.echo('\n{} {} online.'.format( |
| 150 | nodecount, text.pluralize(nodecount, 'node'))) |
| 151 | |
| 152 | |
| 153 | @click.command(cls=CeleryCommand, |
nothing calls this directly
no test coverage detected