396 """loads config file into a dictionary, supports several modifications of the input switched on via additional arguments
397 Supports reading: Pickled file with the CA or properties & JSON
400 print(
"Debugging info from reading ", fname,
" in ", logger.handlers[0].baseFilename)
401 logger.setLevel(logging.DEBUG)
404 if fname.endswith(
".pkl"):
405 with open(fname,
"rb")
as input_file:
407 cfg = pickle.load(input_file)
408 logger.info(
"... Read %s from %s", cfg.__class__.__name__, fname)
409 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
410 if isinstance(cfg, ComponentAccumulator):
411 props = cfg.gatherProps()
415 for comp, name, value
in jos_props:
416 to_json.setdefault(comp, {})[name] = value
417 to_json[comp][name] = value
419 conf[
'ApplicationMgr'] = props[0]
420 conf[
'MessageSvc'] = props[1]
423 cfg, (collections.defaultdict, dict)
426 conf.update(pickle.load(input_file))
428 elif isinstance(cfg, (collections.Sequence)):
431 logger.info(
"... Read %d items from python pickle file: %s", len(conf), fname)
433 elif fname.endswith(
".json"):
435 def __keepPlainStrings(element):
436 if isinstance(element, str):
438 if isinstance(element, list):
439 return [__keepPlainStrings(x)
for x
in element]
440 if isinstance(element, dict):
442 __keepPlainStrings(key): __keepPlainStrings(value)
443 for key, value
in element.items()
447 with open(fname,
"r")
as input_file:
448 cfg = json.load(input_file, object_hook=__keepPlainStrings)
457 if 'properties' in conf:
458 conf = conf[
'properties']
460 logger.info(
"... Read %d items from json file: %s", len(conf), fname)
463 sys.exit(
"File format not supported.")
466 sys.exit(
"Unable to load %s file" % fname)
468 if args.includeComps
or args.excludeComps
or args.includeClasses
or args.excludeClasses:
469 logger.info(f
"include/exclude comps like {args.includeComps}/{args.excludeComps}")
472 if args.ignoreIrrelevant:
475 if args.renameComps
or args.renameCompsFile:
478 if args.ignoreDefaults:
482 if args.shortenDefaultComponents:
485 if args.skipProperties: