Exemplo n.º 1
0
def clear_expired_exceptions():
    """
    Clears out the exception logs table of all exception entries that have expired past the TTL.
    :return:
    """
    app.logger.info("Clearing out exceptions that have an expired TTL...")
    clear_old_exceptions()
    app.logger.info("Completed clearing out exceptions that have an expired TTL.")
Exemplo n.º 2
0
def clear_expired_exceptions():
    """
    Clears out the exception logs table of all exception entries that have expired past the TTL.
    :return:
    """
    print("Clearing out exceptions that have an expired TTL...")
    clear_old_exceptions()
    print("Completed clearing out exceptions that have an expired TTL.")
    def test_exception_clearing(self):
        location = ("iamrole", "testing", "us-west-2", "testrole")

        for i in range(0, 5):
            try:
                raise ValueError("This is test: {}".format(i))
            except ValueError as e:
                test_exception = e

            store_exception("tests", location, test_exception,
                            ttl=(datetime.datetime.now() - datetime.timedelta(days=1)))

        store_exception("tests", location, test_exception)

        clear_old_exceptions()

        # Get all the exceptions:
        exc_list = ExceptionLogs.query.all()

        assert len(exc_list) == 1
Exemplo n.º 4
0
    def test_exception_clearing(self):
        location = ("iamrole", "testing", "us-west-2", "testrole")

        for i in range(0, 5):
            try:
                raise ValueError("This is test: {}".format(i))
            except ValueError as e:
                test_exception = e

            store_exception("tests", location, test_exception,
                            ttl=(datetime.datetime.now() - datetime.timedelta(days=1)))

        store_exception("tests", location, test_exception)

        clear_old_exceptions()

        # Get all the exceptions:
        exc_list = ExceptionLogs.query.all()

        assert len(exc_list) == 1
Exemplo n.º 5
0
def clear_expired_exceptions():
    app.logger.info("[ ] Clearing out exceptions that have an expired TTL...")
    clear_old_exceptions()
    app.logger.info(
        "[-] Completed clearing out exceptions that have an expired TTL.")
Exemplo n.º 6
0
def _clear_old_exceptions():
    print("Clearing out exceptions that have an expired TTL...")
    clear_old_exceptions()
    print("Completed clearing out exceptions that have an expired TTL.")
Exemplo n.º 7
0
def clear_expired_exceptions():
    app.logger.info("[ ] Clearing out exceptions that have an expired TTL...")
    clear_old_exceptions()
    app.logger.info("[-] Completed clearing out exceptions that have an expired TTL.")