cacheDefinitionData.py
Go to the documentation of this file.
1 #!/bin/env python
2 import os, sys
3 from PageConfig import PageConfig
4 from ChainData import *
5 import argparse
6 
7 prog=sys.argv[0]
8 parser = argparse.ArgumentParser(prog=prog, description='Cache information about definitions for which we already have info')
9 
10 srcOptions=parser.add_mutually_exclusive_group(required=True)
11 
12 srcOptions.add_argument("--pageConfig",
13  help="Download info for definitions for chains listed in a web-page config",
14  type=str)
15 
16 srcOptions.add_argument("--chainConfig",
17  help="Download info for definitions listed in a chain configuration",
18  type=str)
19 
20 srcOptions.add_argument("--definition",
21  help="Download info for definition",
22  type=str)
23 
24 args=parser.parse_args()
25 
26 if args.definition:
27  defName=args.definition
28  cacheDefinitionData(defName)
29 
30 elif args.pageConfig:
31  cfg=PageConfig(args.pageConfig)
32 
33  for chain in cfg.chains:
34  for tier in chain.tierData.keys():
35  definition=chain.tierData[tier]
36  cacheDefinitionData(definition.name)
37 
38 
39