Пример #1
0
"""
sentry.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from sentry.commands.utils import options, opt


@options(
    opt('--days', default='30', type=int, help='Numbers of days to truncate on.'),
    opt('--logger', help='Limit truncation to only entries from logger.'),
    opt('--site', help='Limit truncation to only entries from site.'),
    opt('--server', help='Limit truncation to only entries from server.'),
    opt('--level', help='Limit truncation to only entries greater than or equal to level (e.g. DEBUG).'),
    opt('--project', type=int, help='Limit truncation to only entries from project.'),
)
def cleanup(days=30, logger=None, site=None, server=None, level=None,
            project=None):
    import logging
    from sentry.queue.tasks.cleanup import cleanup

    if level is not None and not str(level).isdigit():
        level = getattr(logging, level.upper())

    cleanup(
        days=days,
        logger=logger,
        site=site,
        server=server,
Пример #2
0
"""
sentry.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.management import call_command
from django.conf import settings
from sentry.commands.utils import options, opt


@options(
    opt('--interactive', default=False, action='store_true'),
    opt('--delete-ghost-migrations', default=True, dest='delete_ghosts'),
)
def upgrade(interactive=True, delete_ghosts=True):
    call_command('syncdb', database='default', interactive=interactive)

    if 'south' in settings.INSTALLED_APPS:
        call_command('migrate', database='default', interactive=interactive, delete_ghosts=delete_ghosts)

    register_views()


def register_views():
    from sentry.views import View as ViewHandler
    from sentry.models import View

    for viewhandler in ViewHandler.objects.all():
        path = '%s.%s' % (viewhandler.__module__, viewhandler.__class__.__name__)
Пример #3
0
    }
    if daemonize:
        log = open(os.path.join(settings.LOG_DIR, '%s.log' % (service,)), 'w+')
        kwargs.update({
            'pidfile': os.path.join(settings.RUN_DIR, '%s.pid' % (service,)),
            'stderr': log,
            'stdout': log,
        })

    proc = daemon.Daemon(**kwargs)

    return proc


@options(
    opt('--daemon', '-d', action='store_true', default=False, dest='daemonize'),
    opt('--no-daemon', '-f', action='store_false', default=False, dest='daemonize'),
    opt('--debug', action='store_true', default=False, dest='debug'),
)
@consume_args
def start(args, daemonize=False, debug=False):
    from sentry.conf import settings

    service = get_service_from_args(args)

    if not os.path.exists(settings.LOG_DIR):
        os.makedirs(settings.LOG_DIR)

    if not os.path.exists(settings.RUN_DIR):
        os.makedirs(settings.RUN_DIR)
Пример #4
0
"""
sentry.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from sentry.commands.utils import options, opt


@options(
    opt('--days', default='30', type=int, help='Numbers of days to truncate on.'),
    opt('--logger', help='Limit truncation to only entries from logger.'),
    opt('--site', help='Limit truncation to only entries from site.'),
    opt('--server', help='Limit truncation to only entries from server.'),
    opt('--level', help='Limit truncation to only entries greater than or equal to level (e.g. DEBUG).'),
    opt('--project', type=int, help='Limit truncation to only entries from project.'),
    opt('--resolved', dest='resolved', action='store_true', help='Limit truncation to only entries that are resolved.'),
    opt('--unresolved', dest='resolved', action='store_false', help='Limit truncation to only entries that are unresolved.'),
)
def cleanup(days=30, logger=None, site=None, server=None, level=None,
            project=None, resolved=None):
    import logging
    from sentry.queue.tasks.cleanup import cleanup

    if level is not None and not str(level).isdigit():
        level = getattr(logging, level.upper())

    cleanup(
        days=days,
        logger=logger,
Пример #5
0
"""
sentry.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.management import call_command
from django.conf import settings
from sentry.commands.utils import options, opt


@options(
    opt('--interactive', default=False, action='store_true'), )
def upgrade(interactive=True):
    call_command('syncdb', database='default', interactive=interactive)

    if 'south' in settings.INSTALLED_APPS:
        call_command('migrate', database='default', interactive=interactive)

    register_views()


def register_views():
    from sentry.views import View as ViewHandler
    from sentry.models import View

    for viewhandler in ViewHandler.handlers.all():
        path = '%s.%s' % (viewhandler.__module__,
                          viewhandler.__class__.__name__)
Пример #6
0
"""
sentry.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from sentry.commands.utils import options, opt


@options(
    opt('--days',
        default='30',
        type=int,
        help='Numbers of days to truncate on.'),
    opt('--logger', help='Limit truncation to only entries from logger.'),
    opt('--site', help='Limit truncation to only entries from site.'),
    opt('--server', help='Limit truncation to only entries from server.'),
    opt('--level',
        help=
        'Limit truncation to only entries greater than or equal to level (e.g. DEBUG).'
        ),
    opt('--project',
        type=int,
        help='Limit truncation to only entries from project.'),
)
def cleanup(days=30,
            logger=None,
            site=None,
            server=None,
            level=None,
Пример #7
0
"""
sentry.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.management import call_command
from django.conf import settings
from sentry.commands.utils import options, opt


@options(
    opt('--interactive', default=False, action='store_true'),
)
def upgrade(interactive=True):
    call_command('syncdb', database='default', interactive=interactive)

    if 'south' in settings.INSTALLED_APPS:
        call_command('migrate', database='default', interactive=interactive)

    register_views()


def register_views():
    from sentry.views import View as ViewHandler
    from sentry.models import View

    for viewhandler in ViewHandler.objects.all():
        path = '%s.%s' % (viewhandler.__module__, viewhandler.__class__.__name__)