diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a..e6964e6 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,18 +1,28 @@ -#!/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 +from datetime import datetime + +from sqlalchemy import and_, select, null, true + +from rucio.db.sqla import models from rucio.db.sqla.session import get_session # Exit statuses @@ -25,28 +35,51 @@ def main(): ''' status = OK session = get_session() + + base_statement = select( + models.ReplicationRule.id, + models.ReplicationRule.name, + models.ReplicationRule.scope, + models.ReplicationRule.rse_expression, + ) + try: - query = "select rawtohex(id), scope, name, rse_expression from atlas_rucio.rules where locked=1 and expires_at