コード例 #1
0
def notify_of_failure(message, query):
    subscribed = query.org.get_setting('send_email_on_failed_scheduled_queries')
    exceeded_threshold = query.schedule_failures >= settings.MAX_FAILURE_REPORTS_PER_QUERY

    if subscribed and not query.user.is_disabled and not exceeded_threshold:
        redis_connection.lpush(key(query.user.id), json_dumps({
            'id': query.id,
            'name': query.name,
            'message': message,
            'schedule_failures': query.schedule_failures,
            'failed_at': datetime.datetime.utcnow().strftime("%B %d, %Y %I:%M%p UTC")
        }))
コード例 #2
0
def notify_of_failure(message, query):
    subscribed = query.org.get_setting("send_email_on_failed_scheduled_queries")
    exceeded_threshold = (
        query.schedule_failures >= settings.MAX_FAILURE_REPORTS_PER_QUERY
    )

    if subscribed and not query.user.is_disabled and not exceeded_threshold:
        redis_connection.lpush(
            key(query.user.id),
            json_dumps(
                {
                    "id": query.id,
                    "name": query.name,
                    "message": message,
                    "schedule_failures": query.schedule_failures,
                    "failed_at": datetime.datetime.utcnow().strftime(
                        "%B %d, %Y %I:%M%p UTC"
                    ),
                }
            ),
        )