3 from AnalyzeStatsArgs
import args
5 from Analyses
import Analyses
6 import analyze_config
as anconf
8 from copy
import deepcopy
9 import diag_utils
as du
12 import multiprocessing
as mp
14 import StatisticsDatabase
as sdb
16 _logger = logging.getLogger(__name__)
22 'basic_plot_functions',
36 Main function that sequentially
37 () collates command-line arguments from AnalyzeStatsArgs with static
38 configuration modules (config and analysis_config)
39 () loops over selected DiagSpaces, and for each
40 - initializes StatisticsDatabase object (internal multiprocessing)
41 - analyzes the statistics for all selected anconf.analysisTypes (internal multiprocessing)
42 See analysis_config for more information
44 _logger.info(
'Starting main()')
46 DiagSpaceConfig = deepcopy(conf.DiagSpaceConfig)
47 for key
in sorted(DiagSpaceConfig):
48 if not DiagSpaceConfig[key][
'process']: del DiagSpaceConfig[key]
53 npan = min(int(args.npan), mp.cpu_count())
57 npread = min(int(args.npread), mp.cpu_count())
63 selectDiagSpace =
None
65 selectDiagSpace = args.diagSpace
70 for key
in sorted(DiagSpaceConfig):
71 if ((selectDiagSpace
is not None and selectDiagSpace
not in key)
or
72 (anGrp
is not None and DiagSpaceConfig[key][
'anGrp'] != anGrp)):
73 del DiagSpaceConfig[key]
77 analysisTypes = [args.analysisType]
79 analysisTypes = anconf.analysisTypes
82 for DiagSpaceName
in sorted(DiagSpaceConfig):
84 myDBConf = deepcopy(anconf.dbConf)
85 myDBConf[
'DiagSpaceName'] = DiagSpaceName
87 myDBConf[
'diagnosticConfigs'] = du.diagnosticConfigs(
88 DiagSpaceConfig[DiagSpaceName][
'diagNames'], DiagSpaceName,
89 analysisStatistics = anconf.analysisStatistics)
90 for diag
in list(myDBConf[
'diagnosticConfigs'].keys()):
91 if not myDBConf[
'diagnosticConfigs'][diag][
'analyze']:
92 del myDBConf[
'diagnosticConfigs'][diag]
95 db = sdb.StatsDB(myDBConf)
99 _logger.info(
'Analyzing StatsDB for '+DiagSpaceName)
104 analyses =
Analyses(db, analysisTypes, anconf.diagnosticGroupings, npan)
108 _logger.info(
'Finished main() successfully')
110 if __name__ ==
'__main__':
main()