From 4073c362c63673a5d0bcb547b237ec4f7d2c386f Mon Sep 17 00:00:00 2001 From: voetberg Date: Tue, 23 Sep 2025 08:56:58 -0500 Subject: [PATCH 1/3] Common: Upgrade to python3 #127 --- common/check_expired_locked_rules | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a1..1e77be82 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright European Organization for Nuclear Research (CERN) 2013 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,12 +27,12 @@ def main(): session = get_session() try: query = "select rawtohex(id), scope, name, rse_expression from atlas_rucio.rules where locked=1 and expires_at Date: Tue, 23 Sep 2025 08:57:29 -0500 Subject: [PATCH 2/3] Common: Update header #127 --- common/check_expired_locked_rules | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 1e77be82..9bbda07b 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,12 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) 2013 +# 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 From ec4b89be7b0cea29bf95cd3639fd6fb7ccf040f2 Mon Sep 17 00:00:00 2001 From: voetberg Date: Tue, 23 Sep 2025 09:01:15 -0500 Subject: [PATCH 3/3] Common: Upgrade probe to sqla2.0 #127 --- common/check_expired_locked_rules | 44 +++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 9bbda07b..e6964e6e 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -18,6 +18,11 @@ 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 @@ -30,26 +35,49 @@ 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