Go to the documentation of this file.00001
00002
00003
00004
00005 import sys
00006 import xmlrpclib
00007
00008
00009 def displayHelp():
00010 print """
00011 getRunRegistry.py
00012
00013 CMSSW package DQM/TrackerCommon
00014
00015 Usage:
00016 $ getRunRegistry.py [ARGUMENTOPTION1] [ARGUMENT1] ... [OPTION2] ...
00017
00018 Valid argument options are:
00019 -s
00020 API address of RunRegistry server
00021 default: 'http://pccmsdqm04.cern.ch/runregistry/xmlrpc'
00022 -T
00023 table identifier
00024 available: 'RUN', 'RUNLUMISECTION'
00025 default: 'RUN'
00026 -w
00027 work space identifier
00028 available: 'RPC', 'HLT', 'L1T', 'TRACKER', 'CSC', 'GLOBAL', 'ECAL'
00029 default: 'GLOBAL'
00030 -t
00031 output format type
00032 available:
00033 - table 'RUN' : 'chart_runs_cum_evs_vs_bfield', 'chart_runs_cum_l1_124_vs_bfield', 'chart_stacked_component_status', 'csv_datasets', 'csv_run_numbers', 'csv_runs', 'tsv_datasets', 'tsv_runs', 'xml_all', 'xml_datasets'
00034 - table 'RUNLUMISECTION': 'json', 'xml'
00035 default: 'xml_all' (for table 'RUN')
00036 -f
00037 output file
00038 default: 'runRegistry.xml'
00039 -l
00040 lower bound of run numbers to consider
00041 default: '0'
00042 -u
00043 upper bound of run numbers to consider
00044 default: '1073741824'
00045
00046 Valid options are:
00047 -h
00048 display this help and exit
00049 """
00050
00051
00052
00053 sOptions = {
00054 '-s': 'http://pccmsdqm04.cern.ch/runregistry/xmlrpc'
00055 , '-T': 'RUN'
00056 , '-w': 'GLOBAL'
00057 , '-t': 'xml_all'
00058 , '-f': 'runRegistry.xml'
00059 , '-l': '0'
00060 , '-u': '1073741824'
00061 }
00062 bOptions = {
00063 '-h': False
00064 }
00065 iArgument = 0
00066 for token in sys.argv[ 1:-1 ]:
00067 iArgument = iArgument + 1
00068 if token in sOptions.keys():
00069 if not sys.argv[ iArgument + 1 ] in sOptions.keys() and not sys.argv[ iArgument + 1 ] in bOptions.keys():
00070 del sOptions[ token ]
00071 sOptions[ token ] = sys.argv[ iArgument + 1 ]
00072 for token in sys.argv[ 1: ]:
00073 if token in bOptions.keys():
00074 del bOptions[ token ]
00075 bOptions[ token ] = True
00076 if bOptions[ '-h' ]:
00077 displayHelp()
00078 sys.exit( 0 )
00079
00080
00081
00082 server = xmlrpclib.ServerProxy( sOptions[ '-s' ] )
00083
00084 runs = '{runNumber} >= ' + sOptions[ '-l' ] + 'and {runNumber} <= ' + sOptions[ '-u' ]
00085 data = server.DataExporter.export( sOptions[ '-T' ], sOptions[ '-w' ], sOptions[ '-t' ], runs )
00086
00087 file = open( sOptions[ '-f' ], 'w' )
00088 file.write( data )
00089 file.close()