Skip to content

Commit

Permalink
Consistency: Port Dark Reaper to Python 3 #4256
Browse files Browse the repository at this point in the history
  • Loading branch information
dchristidis authored and bari12 committed Jan 21, 2021
1 parent 82b20f3 commit 0caf5d4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/rucio/daemons/reaper/dark_reaper.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2020 CERN
# Copyright 2016-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@
# - Brandon White <bjwhite@fnal.gov>, 2019
# - Patrick Austin <patrick.austin@stfc.ac.uk>, 2020
# - Benedikt Ziemons <benedikt.ziemons@cern.ch>, 2020
# - Dimitrios Christidis <dimitrios.christidis@cern.ch>, 2020
# - Dimitrios Christidis <dimitrios.christidis@cern.ch>, 2020-2021

'''
Dark Reaper is a daemon to manage quarantined file deletion.
Expand Down Expand Up @@ -83,7 +83,7 @@ def reaper(rses=[], worker_number=0, total_workers=1, chunk_size=100, once=False
thread = threading.current_thread()
hostname = socket.gethostname()
executable = ' '.join(sys.argv)
hash_executable = hashlib.sha256(sys.argv[0] + ''.join(rses)).hexdigest()
hash_executable = hashlib.sha256((sys.argv[0] + ''.join(rses)).encode()).hexdigest()
sanity_check(executable=None, hostname=hostname)

while not GRACEFUL_STOP.is_set():
Expand Down Expand Up @@ -111,9 +111,12 @@ def reaper(rses=[], worker_number=0, total_workers=1, chunk_size=100, once=False
if replica['scope']:
scope = replica['scope'].external
try:
pfn = str(rsemgr.lfns2pfns(rse_settings=rse_info,
lfns=[{'scope': scope, 'name': replica['name'], 'path': replica['path']}],
operation='delete', scheme=scheme).values()[0])
pfn = str(list(rsemgr.lfns2pfns(rse_settings=rse_info,
lfns=[{'scope': scope,
'name': replica['name'],
'path': replica['path']}],
operation='delete',
scheme=scheme).values())[0])
logging.info('Dark Reaper %s-%s: Deletion ATTEMPT of %s:%s as %s on %s', worker_number, total_workers, scope, replica['name'], pfn, rse)
start = time.time()
prot.delete(pfn)
Expand Down

0 comments on commit 0caf5d4

Please sign in to comment.