Commit 7638ba1d authored by James Clark's avatar James Clark
Browse files

Only look for new files to register since the last pass

parent 8573e0a5
Pipeline #79112 passed with stages
in 1 minute and 9 seconds
......@@ -36,12 +36,24 @@ import rucio.rse.rsemanager as rsemgr
from ligo_rucio import rucio_data
from ligo_rucio.diskcache import DiskCacheFile
# Number of seconds between unix and GPS epochs
EPOCH_DIFFERENCE = 315964782
SUCCESS = 0
FAILURE = 1
MAX_CACHE_TRIES = 5
LOGGER = logging.getLogger('user')
def gps(unixtime):
"""
convert the unix time unix to GPS so we only have to register files which
have shown up since the last registration iteration.
Implemented as: unix_epoch - 315964782
"""
return unixtime - EPOCH_DIFFERENCE
def setup_logger(logger):
"""
Configures logging information. Lifted from `rucio`.
......@@ -324,6 +336,7 @@ def daemon(aparser):
# Begin Daemon loop
LOGGER.info("Starting registration loop")
minimum_gps = rsets[rset]['minimum-gps']
daemon_running = True
while daemon_running:
......@@ -337,15 +350,13 @@ def daemon(aparser):
LOGGER.debug("Finding %s in DiskCache", rset)
rsets[rset]['diskcache'] = DiskCacheFile(
aparser.cachefile,
# FIXME set minimum GPS to last_check (and confirm that
# mtime of DiskCache is last modify time of *file*, not
# Cache object)
minimum_gps=rsets[rset]['minimum-gps'],
minimum_gps=minimum_gps,
maximum_gps=rsets[rset]['maximum-gps'],
regexp=rsets[rset]['regexp'],
prune=True,
update_file_count=True)
last_check = time.time()
minimum_gps = gps(last_check)
break
except (IOError, OSError, StopIteration) as cache_error:
# StopIteration if cachefile is incomplete
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment