diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a..6119ff8 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,56 +1,118 @@ -#!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +#!/usr/bin/env python3 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # 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 # -# Authors: -# - Cedric Serfon, , 2015 +# 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. + -''' +""" Probe to check the locked expired rules or datasets with locked rules -''' +""" import sys +import traceback +from collections import defaultdict +from datetime import datetime + +from sqlalchemy import and_, select +from sqlalchemy.sql import null, true + +from rucio.db.sqla import models from rucio.db.sqla.session import get_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