/
rucio-reaper
executable file
·83 lines (74 loc) · 4.07 KB
/
rucio-reaper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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
#
# 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.
'''
'''
import argparse
import signal
from rucio.common.utils import StoreAndDeprecateWarningAction
from rucio.daemons.reaper.reaper import Reaper
def get_parser():
"""
Returns the argparse parser.
"""
parser = argparse.ArgumentParser()
parser.add_argument("--run-once", action="store_true", default=False,
help='Runs one loop iteration')
parser.add_argument("--threads", action="store", default=1, type=int,
help='Concurrency control: number of threads')
parser.add_argument("--chunk_size", "--chunk-size", new_option_string="--chunk-size", action=StoreAndDeprecateWarningAction, default=100, type=int,
help='The size used for a bulk deletion on on RSE')
parser.add_argument('--sleep-time', action="store", default=60, type=int,
help='Minimum time between 2 consecutive cycles')
parser.add_argument('--greedy', action="store_true", default=False,
help='To enable greedy mode. Deprecated, kept for compatibility reasons. Recommended way is to use RSE attribute greedyDeletion=True')
parser.add_argument('--exclude-rses', action="store", default=None, type=str,
help='RSE expression to exclude')
parser.add_argument('--include-rses', action="store", default=None, type=str,
help='RSE expression to include')
parser.add_argument('--rses', nargs='+', type=str,
help='Explicit list of RSEs to include. If empty, it considers all RSEs')
parser.add_argument('--vos', nargs='+', type=str,
help='Optional list of VOs to consider. Only used in multi-VO mode.')
parser.add_argument("--delay-seconds", action="store", default=600, type=int,
help='The delay (seconds) to query replicas in BEING_DELETED state.')
parser.add_argument('--scheme', action="store", default=None, type=str,
help='Force the reaper to use a particular protocol/scheme, e.g., mock')
parser.add_argument("--auto_exclude_threshold", "--auto-exclude-threshhold", new_option_string="--auto-exclude-threshhold", action=StoreAndDeprecateWarningAction, default=100, type=int,
help='Number of service unavailable exceptions after which the RSE gets temporarily excluded.')
parser.add_argument("--auto_exclude_timeout", "--auto-exclude-timeout", new_option_string="--auto-exclude-timeout", action=StoreAndDeprecateWarningAction, default=600, type=int,
help='Timeout for temporarily excluded RSEs.')
return parser
if __name__ == "__main__":
parser = get_parser()
args = parser.parse_args()
reaper = Reaper(threads=args.threads,
chunk_size=args.chunk_size,
include_rses=args.include_rses,
exclude_rses=args.exclude_rses,
rses=args.rses,
vos=args.vos,
once=args.run_once,
greedy=args.greedy,
scheme=args.scheme,
delay_seconds=args.delay_seconds,
sleep_time=args.sleep_time,
auto_exclude_threshold=args.auto_exclude_threshold,
auto_exclude_timeout=args.auto_exclude_timeout)
signal.signal(signal.SIGTERM, reaper.stop)
try:
reaper.run()
except KeyboardInterrupt:
reaper.stop()