Exemple #1
0
    def check(self):
        # There is no queue, and celery is not running, so never show error
        if settings.CELERY_ALWAYS_EAGER:
            return []
        last_ping = options.get("sentry:last_worker_ping") or 0
        if last_ping >= time() - 300:
            return []

        backlogged, size = None, 0
        from sentry.monitoring.queues import backend

        if backend is not None:
            size = backend.get_size("default")
            backlogged = size > 0

        message = "Background workers haven't checked in recently. "
        if backlogged:
            message += (
                "It seems that you have a backlog of %d tasks. Either your workers aren't running or you need more capacity."
                % size)
        else:
            message += (
                "This is likely an issue with your configuration or the workers aren't running."
            )

        return [Problem(message, url=absolute_uri("/manage/queue/"))]
Exemple #2
0
    def check(self):
        # There is no queue, and celery is not running, so never show error
        if settings.CELERY_ALWAYS_EAGER:
            return []
        last_ping = options.get('sentry:last_worker_ping') or 0
        if last_ping >= time() - 300:
            return []

        backlogged, size = None, 0
        from sentry.monitoring.queues import backend
        if backend is not None:
            size = backend.get_size('default')
            backlogged = size > 0

        message = "Background workers haven't checked in recently. "
        if backlogged:
            message += "It seems that you have a backlog of %d tasks. Either your workers aren't running or you need more capacity." % size
        else:
            message += "This is likely an issue with your configuration or the workers aren't running."

        return [
            Problem(
                message,
                url=absolute_uri('/manage/queue/'),
            ),
        ]
Exemple #3
0
def purge(force, queue):
    "Purge all messages from a queue."

    from sentry.monitoring.queues import get_queue_by_name, backend

    if get_queue_by_name(queue) is None:
        raise click.ClickException("unknown queue: %r" % queue)

    if backend is None:
        raise click.ClickException("unknown broker type")

    size = backend.get_size(queue)

    if size == 0:
        click.echo("Queue is empty, nothing to purge", err=True)
        return

    if not force:
        click.confirm(
            "Are you sure you want to purge %d messages from the queue '%s'?" %
            (size, queue),
            abort=True,
        )

    click.echo("Poof, %d messages deleted" % backend.purge_queue(queue),
               err=True)
Exemple #4
0
def purge(force, queue):
    "Purge all messages from a queue."

    from sentry.monitoring.queues import get_queue_by_name, backend

    if get_queue_by_name(queue) is None:
        raise click.ClickException('unknown queue: %r' % queue)

    if backend is None:
        raise click.ClickException('unknown broker type')

    size = backend.get_size(queue)

    if size == 0:
        click.echo('Queue is empty, nothing to purge', err=True)
        return

    if not force:
        click.confirm('Are you sure you want to purge %d messages from the queue \'%s\'?' % (size, queue), abort=True)

    click.echo('Poof, %d messages deleted' % backend.purge_queue(queue), err=True)