-
Notifications
You must be signed in to change notification settings - Fork 302
/
rucio-rse-decommissioner
executable file
·66 lines (53 loc) · 2.3 KB
/
rucio-rse-decommissioner
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
#!/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
#
# 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.
"""
RSE-Decommissioner is a daemon that clears RSEs scheduled for decommissioning.
The actual operations (e.g. just delete all replicas, move the replicas to
specific RSEs, etc.) that are performed on the RSEs depend on the
"decommissioning profile", which must be specified for each RSE through RSE
attributes.
"""
import argparse
import signal
from rucio.daemons.rsedecommissioner.rse_decommissioner import run, stop
def get_parser() -> argparse.ArgumentParser:
"""Construct and return the argparse parser."""
parser = argparse.ArgumentParser(
description=__doc__,
epilog="""\
To mark an RSE for decommissioning
----------------------------------
Clearing with the generic "delete all" profile:
$ rucio-admin rse set-attribute --rse MOCK_RSE --key decommission \
--value profile=generic_delete
Clearing with the generic "move all" profile:
$ rucio-admin rse set-attribute --rse MOCK_RSE --key decommission \
--value profile=generic_move,destination=ANOTHER_RSE""",
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument('--run-once', dest='run_once', action='store_true',
help='One iteration only.')
parser.add_argument('--sleep-time', dest='sleep_time', action='store',
default=86400, type=int,
help='Concurrency control: thread sleep time after each'
' chunk of work')
return parser
if __name__ == '__main__':
signal.signal(signal.SIGTERM, stop)
args = get_parser().parse_args()
try:
run(once=args.run_once, sleep_time=args.sleep_time)
except KeyboardInterrupt:
stop()