def setup(): global log_and_maybe_exec global maybe_move global runinfo global ecal_pool global dqm_pool global evd_pool global lookarea_pool global cfg cfg = config.config logger.info('Using config file(s): %s ...' % ', '.join(cfg.filenames)) _dry_run = cfg.getboolean('Misc', 'dry_run') bookkeeper._dry_run = _dry_run bookkeeper.setup() runinfo = RunInfo(os.path.join(config.DIR, '.db.omds.runinfo_r.cfg.py')) if _dry_run: log_and_maybe_exec = log_and_do_not_exec maybe_move = mock_move_file_to_dir else: log_and_maybe_exec = log_and_exec maybe_move = move_file_to_dir ecal_pool = ThreadPool(5) dqm_pool = ThreadPool(5) evd_pool = ThreadPool(5) lookarea_pool = ThreadPool(5)
def setup(): global log_and_maybe_exec global maybe_move global runinfo global ecal_pool global dqm_pool global evd_pool global lookarea_pool global cfg cfg = config.config logger.info( 'Using config file(s): %s ...' % ', '.join(cfg.filenames) ) _dry_run = cfg.getboolean('Misc','dry_run') bookkeeper._dry_run = _dry_run bookkeeper.setup() runinfo = RunInfo(os.path.join(config.DIR, '.db.omds.runinfo_r.cfg.py')) if _dry_run: log_and_maybe_exec = log_and_do_not_exec maybe_move = mock_move_file_to_dir else: log_and_maybe_exec = log_and_exec maybe_move = move_file_to_dir ecal_pool = ThreadPool(5) dqm_pool = ThreadPool(5) evd_pool = ThreadPool(5) lookarea_pool = ThreadPool(5)
def setup(cfg): ''' Sets up the logging configuration. Plan to apply configuration. ''' ## Get global configurations from the config module myconfig = config.config logger.info( 'Using config file(s): %s ...' % ', '.join(myconfig.filenames) ) myconfig.getlist = getlist_from_config(myconfig) cfg.input_path = myconfig.get('eor', 'input_path') cfg.store_ini_area = myconfig.get('eor', 'store_ini_area') cfg.general_dryrun = myconfig.getboolean('eor', 'general_dryrun') cfg.max_iterations = myconfig.getfloat('eor', 'max_iterations') cfg.seconds_to_sleep = myconfig.getfloat('eor', 'seconds_to_sleep') cfg.seconds_to_delay_run_closure = myconfig.getfloat( 'eor', 'seconds_to_delay_run_closure' ) cfg.hours_to_wait_for_completion = myconfig.getfloat( 'eor', 'hours_to_wait_for_completion' ) cfg.runs_last = myconfig.getint('eor', 'runs_last') cfg.streams_to_exclude = [] for stream_list in myconfig.getlist('eor', 'streams_to_exclude'): cfg.streams_to_exclude.extend( myconfig.getlist('Streams', stream_list) ) bookkeeper._dry_run = cfg.general_dryrun ## Integration DB, will not be read by Tier0 #bookkeeper._db_config = '.db.int2r.stomgr_w.cfg.py' ## Production DB, will be read by Tier0 bookkeeper._db_config = myconfig.get('eor', 'db_config_path') logger.debug("Using `%s' for DB credentials ..." % bookkeeper._db_config) bookkeeper.setup() bookkeeper._input_dir = cfg.input_path bookkeeper._excluded_streams = cfg.streams_to_exclude bookkeeper.setup() logger.debug("Using %s for input directory ..." % bookkeeper._input_dir) logger.debug("Using %s for streams to exclude ..." % bookkeeper._excluded_streams) if not cfg.json_suffix: cfg.json_suffix = socket.gethostname() cfg.time_to_wait_for_completion = timedelta( hours=cfg.hours_to_wait_for_completion )