CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
confdbOfflineConverter.OfflineConverter Class Reference

Public Member Functions

def __init__
 
def query
 

Static Public Member Functions

def CheckTempDirectory
 

Public Attributes

 baseDir
 
 baseUrl
 
 connect
 
 jars
 
 javaCmd
 
 verbose
 
 workDir
 

Static Public Attributes

dictionary databases = {}
 

Detailed Description

Definition at line 10 of file confdbOfflineConverter.py.

Constructor & Destructor Documentation

def confdbOfflineConverter.OfflineConverter.__init__ (   self,
  database = 'hltdev',
  url = None,
  verbose = False 
)

Definition at line 28 of file confdbOfflineConverter.py.

28 
29  def __init__(self, database = 'hltdev', url = None, verbose = False):
30  self.verbose = verbose
31  self.baseDir = '/afs/cern.ch/user/c/confdb/www/lib'
32  self.baseUrl = 'http://confdb.web.cern.ch/confdb/lib'
33  self.jars = ( 'ojdbc6.jar', 'cmssw-evf-confdb-converter.jar' )
34  self.workDir = ''
35 
36  # check the database
37  if database in self.databases:
38  # load the connection parameters for the given database
39  self.connect = self.databases[database]
40  else:
41  # unsupported database
42  sys.stderr.write( "ERROR: unknown database \"%s\"\n" % database)
43  sys.exit(1)
44 
45  # check for a custom base URL
46  if url is not None:
47  self.baseUrl = url
48 
49  # try to read the .jar files from AFS, or download them
50  if os.path.isdir(self.baseDir) and all(os.path.isfile(self.baseDir + '/' + jar) for jar in self.jars):
51  # read the .jar fles from AFS
52  self.workDir = self.baseDir
53  else:
54  # try to use $CMSSW_BASE/tmp
55  self.workDir = OfflineConverter.CheckTempDirectory(os.environ['CMSSW_BASE'] + '/tmp/confdb')
56  if not self.workDir:
57  # try to use $TMP
58  self.workDir = OfflineConverter.CheckTempDirectory(os.environ['TMP'] + '/confdb')
59  if not self.workDir:
60  # create a new temporary directory, and install a cleanup callback
61  self.workDir = tempfile.mkdtemp()
62  atexit.register(shutil.rmtree, self.workDir)
63  # download the .jar files
64  for jar in self.jars:
65  urllib.urlretrieve(self.baseUrl + '/' + jar, self.workDir + '/' + jar)
66 
67  # setup the java command line and CLASSPATH
68  if self.verbose:
69  sys.stderr.write("workDir = %s\n" % self.workDir)
70  self.javaCmd = ( 'java', '-cp', ':'.join(self.workDir + '/' + jar for jar in self.jars), 'confdb.converter.BrowserConverter' )
71 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Function Documentation

def confdbOfflineConverter.OfflineConverter.CheckTempDirectory (   dir)
static

Definition at line 18 of file confdbOfflineConverter.py.

18 
19  def CheckTempDirectory(dir):
20  dir = os.path.realpath(dir)
21  if not os.path.isdir(dir):
22  try:
23  os.makedirs(dir)
24  except:
25  return None
26  return dir
27 
def confdbOfflineConverter.OfflineConverter.query (   self,
  args 
)

Definition at line 72 of file confdbOfflineConverter.py.

References DTDQMHarvesting.DTDQMHarvesting.connect, DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.connect, DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.connect, DTNoiseCalibration.DTNoiseCalibration.connect, DTDQMValidation.DTDQMValidation.connect, DTAnalysisResiduals.DTAnalysisResiduals.connect, DTResidualCalibration.DTResidualCalibration.connect, DTTTrigProd.DTTTrigProd.connect, DTTTrigValid.DTTTrigValid.connect, confdbOfflineConverter.OfflineConverter.connect, DTTTrigResidualCorr.DTTTrigResidualCorr.connect, DDTOBRodAlgo.connect, confdbOfflineConverter.OfflineConverter.javaCmd, join(), confdbOfflineConverter.OfflineConverter.verbose, CalibratedPatElectronProducer.verbose, DQMGenericTnPClient.verbose, dqmTnP::AbstractFitter.verbose, CalibratedElectronProducer.verbose, ElectronStudy.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, HIPAlignmentAlgorithm.verbose, and OpticalObject.verbose.

72 
73  def query(self, *args):
74  args = self.javaCmd + self.connect + args
75  if self.verbose:
76  sys.stderr.write("\n" + ' '.join(args) + "\n\n" )
77  sub = subprocess.Popen(
78  args,
79  stdin = None,
80  stdout = subprocess.PIPE,
81  stderr = subprocess.PIPE,
82  shell = False,
83  universal_newlines = True )
84  return sub.communicate()
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Data Documentation

confdbOfflineConverter.OfflineConverter.baseDir

Definition at line 30 of file confdbOfflineConverter.py.

confdbOfflineConverter.OfflineConverter.baseUrl

Definition at line 31 of file confdbOfflineConverter.py.

confdbOfflineConverter.OfflineConverter.connect

Definition at line 38 of file confdbOfflineConverter.py.

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea.__init__(), Vispa.Views.PropertyView.BooleanProperty.__init__(), Vispa.Gui.FindDialog.FindDialog._addScript(), Vispa.Gui.FindDialog.FindDialog._addStringProperty(), Vispa.Main.Application.Application._connectSignals(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView._createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog.addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer.addWidget(), Vispa.Views.PropertyView.PropertyView.append(), Vispa.Views.PropertyView.PropertyView.appendAddRow(), Vispa.Main.Application.Application.createAction(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createButton(), Vispa.Views.LineDecayView.LineDecayView.createLineDecayContainer(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createLineEdit(), Vispa.Views.LineDecayView.LineDecayContainer.createObject(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createTextEdit(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.find(), Vispa.Gui.PortWidget.PortWidget.mouseMoveEvent(), confdbOfflineConverter.OfflineConverter.query(), Vispa.Views.PropertyView.BooleanProperty.setChecked(), Vispa.Main.SplitterTab.SplitterTab.setController(), Vispa.Plugins.Browser.BrowserTab.BrowserTab.setController(), Vispa.Views.PropertyView.BooleanProperty.setReadOnly(), Vispa.Views.PropertyView.DropDownProperty.setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty.setReadOnly(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setTab(), Vispa.Views.PropertyView.IntegerProperty.setValue(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.switchCenterView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateViewMenu().

dictionary confdbOfflineConverter.OfflineConverter.databases = {}
static

Definition at line 12 of file confdbOfflineConverter.py.

confdbOfflineConverter.OfflineConverter.jars

Definition at line 32 of file confdbOfflineConverter.py.

confdbOfflineConverter.OfflineConverter.javaCmd

Definition at line 69 of file confdbOfflineConverter.py.

Referenced by confdbOfflineConverter.OfflineConverter.query().

confdbOfflineConverter.OfflineConverter.verbose

Definition at line 29 of file confdbOfflineConverter.py.

Referenced by python.diff_provenance.difference.list_diff(), python.diffProv.difference.list_diff(), python.diff_provenance.difference.module_diff(), python.diffProv.difference.module_diff(), python.diff_provenance.difference.onefilemodules(), python.diffProv.difference.onefilemodules(), objects.VertexAnalyzer.VertexAnalyzer.process(), and confdbOfflineConverter.OfflineConverter.query().

confdbOfflineConverter.OfflineConverter.workDir

Definition at line 33 of file confdbOfflineConverter.py.