def run(once=False, threads=1): """ Starts up the follower threads """ setup_logging() if rucio.db.sqla.util.is_old_db(): raise exception.DatabaseException( 'Database was not updated, daemon won\'t start') hostname = socket.gethostname() sanity_check(executable='rucio-follower', hostname=hostname) if once: logging.info("executing one follower iteration only") aggregate_events(once) else: logging.info("starting follower threads") # Run the follower daemon thrice a day threads = [ get_thread_with_periodic_running_function(28800, aggregate_events, graceful_stop) for i in range(threads) ] [t.start() for t in threads] logging.info("waiting for interrupts") # Interruptible joins require a timeout. while threads[0].is_alive(): [t.join(timeout=3.14) for t in threads]
def run(once=False, threads=1, fill_history_table=False, sleep_time=10): """ Starts up the Abacus-RSE threads. """ setup_logging() if rucio.db.sqla.util.is_old_db(): raise exception.DatabaseException( 'Database was not updated, daemon won\'t start') executable = 'abacus-rse' hostname = socket.gethostname() sanity_check(executable=executable, hostname=hostname) if once: logging.info('main: executing one iteration only') rse_update(once) else: logging.info('main: starting threads') threads = [ threading.Thread(target=rse_update, kwargs={ 'once': once, 'sleep_time': sleep_time }) for i in range(0, threads) ] if fill_history_table: threads.append( get_thread_with_periodic_running_function( 3600, fill_rse_counter_history_table, graceful_stop)) [t.start() for t in threads] logging.info('main: waiting for interrupts') # Interruptible joins require a timeout. while threads[0].is_alive(): [t.join(timeout=3.14) for t in threads]
def run(once=False, threads=1, fill_history_table=False): """ Starts up the Abacus-Account threads. """ hostname = socket.gethostname() sanity_check(executable='rucio-abacus-account', hostname=hostname) if once: logging.info('main: executing one iteration only') account_update(once) else: logging.info('main: starting threads') threads = [ threading.Thread(target=account_update, kwargs={'once': once}) for i in range(0, threads) ] if fill_history_table: threads.append( get_thread_with_periodic_running_function( 3600, fill_account_counter_history_table, graceful_stop)) [t.start() for t in threads] logging.info('main: waiting for interrupts') # Interruptible joins require a timeout. while threads[0].is_alive(): [t.join(timeout=3.14) for t in threads]