diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a..671dd94 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,56 +1,121 @@ -#!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +#!/usr/bin/env python3 +# Copyright 2012-2024 CERN # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # Authors: # - Cedric Serfon, , 2015 +# - Donata Mielaikaite, , 2020 +# - Eric Vaandering, , 2020 +# - Maggie Voetberg , 2024 + ''' Probe to check the locked expired rules or datasets with locked rules ''' import sys -from rucio.db.sqla.session import get_session +import traceback +from sqlalchemy import select, and_ +from sqlalchemy.sql import functions + +from rucio.db.sqla import models, session +from utils.common import PrometheusPusher # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 +if __name__ == '__main__': -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