From 2fc4118f8681ad8f6f533abbae1afc55dcc52473 Mon Sep 17 00:00:00 2001 From: Fernando Garzon Date: Wed, 20 Jan 2021 10:45:03 -0600 Subject: [PATCH] expired locked rules probe ported to SQLAlchemy --- common/check_expired_locked_rules | 100 +++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 21 deletions(-) diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a1..7bccb783 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -6,51 +6,109 @@ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Authors: -# - Cedric Serfon, , 2015 +# - Cedric Serfon, , 2020. +# - Eric Vaandering, 2020. +# - Fernando Garzon, 2020. -''' +""" Probe to check the locked expired rules or datasets with locked rules -''' +""" + +from __future__ import print_function import sys -from rucio.db.sqla.session import get_session +from datetime import datetime + +from rucio.core import monitor +from rucio.db.sqla import models +from rucio.db.sqla.session import BASE, get_session +from sqlalchemy import func # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 +if BASE.metadata.schema: + schema = BASE.metadata.schema + '.' +else: + schema = '' + def main(): - ''' + """ Probe to check the locked expired rules or datasets with locked rules - ''' + """ status = OK session = get_session() try: - query = "select rawtohex(id), scope, name, rse_expression from atlas_rucio.rules where locked=1 and expires_at