CMS 3D CMS Logo

DQMfromDBSgui.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 #################################################
00004 #
00005 # DQMfromDBSgui.py
00006 #
00007 # v1.4 Beta
00008 #
00009 # by Jeff Temple (jtemple@fnal.gov)
00010 #
00011 # 11 May 2008
00012 #
00013 # v1.3 updates -- separate code into subpackages
00014 #      introduce separate file, dataset substrings
00015 #      reposition daughter windows relative to parent
00016 #
00017 # v1.4 updates -- DQMfromDBSgui.py now inherits from base
00018 #   class in pyDBSguiBaseClass.py
00019 #   Other DQM tools can also inherit from this base class
00020 #
00021 # DQMfromDBSgui.py:
00022 # GUI to automatically grab new runs from DBS
00023 # and run HCAL DQM on any newly-found runs
00024 #
00025 #################################################
00026 
00027 import sys
00028 import os # used for sending user commands
00029 base=os.popen2("echo $CMSSW_BASE")
00030 base=base[1].read()
00031 if len(base)<2:
00032     print "No $CMSSW_BASE directory can be found."
00033     print "Are you sure you've set up your CMSSW release area?"
00034     sys.exit()
00035 
00036 
00037 try:
00038     from Tkinter import *
00039 except:
00040     print "Could not import Tkinter module!"
00041     print "Cannot display GUI!"
00042     print "(If you are running from FNAL, this is a known problem --\n"
00043     print " Tkinter isn't available in the SL4 release of python for some reason."
00044     print "This is being investigated.)"
00045     sys.exit()
00046 
00047 import tkMessageBox # for displaying warning messages
00048 
00049 import thread # used for automated checking; may not be necessary
00050 import time # use to determine when to check for files
00051 import cPickle # stores file information
00052 import python_dbs # use for "sendmessage" function to get info from DBS
00053 import string # DBS output parsing
00054 import helpfunctions  # displays text in new window
00055 
00056 
00057 from pyDBSRunClass import DBSRun  # Gets class that holds information as to whether a given run has been processed through DQM
00058 
00059 from pydbsAccessor import dbsAccessor  # sends queries to DBS
00060 from pyDBSguiBaseClass import dbsBaseGui # get main gui package
00061 
00062 
00063 ############################################################
00064 
00065 # Silly inheritance:  DQMfromDBSgui.py makes no changes from base class gui
00066 
00067 class DQMfromDBSgui(dbsBaseGui):
00068     '''
00069     *** DQMfromDBSgui ***
00070     Looks in DBS, and runs HCAL DQM on resulting found files.
00071     '''
00072 
00073     def __init__(self,parent=None,debug=False):
00074         ''' *** DQMfromDBSgui.__init__ ***
00075         Call the base class __init__ function, and replaces necessary variables
00076         with DQMfromDBSgui-specific values.
00077         '''
00078         
00079         dbsBaseGui.__init__(self,parent,debug)
00080         # Not ready to use prescaling just yet -- it's awfully slow
00081         # Maybe run the Prescaler module at FWCore/Modules/src/Prescaler.cc?
00082         self.prescaleOverRunText="#replace hcalMonitor.diagnosticPrescaleEvt = "
00083 
00084         if (self.debug):
00085             print self.__doc__
00086             print self.__init__.__doc__
00087 
00088         return
00089 
00090 
00091 ###########################################################
00092 
00093 if __name__=="__main__":
00094 
00095     debug=False
00096 
00097     # Use option parsing to enable/disable debugging from the command line
00098     try:
00099         from optparse import OptionParser
00100         parser=OptionParser()
00101         # If "-d" option used, set debug variable true
00102         parser.add_option("-d","--debug",
00103                           dest="debug",
00104                           action="store_true",
00105                           help = "Enable debugging when GUI runs",
00106                           default=False)
00107 
00108         (options,args)=parser.parse_args(sys.argv)
00109         debug=options.debug
00110     except:
00111         print "Dang, optionParsing didn't work"
00112         print "Starting GUI anyway"
00113 
00114 
00115     # Now run the GUI
00116     mygui=DQMfromDBSgui(debug=debug)  # set up gui
00117     mygui.DrawGUI()
00118     mygui.root.mainloop() # run main loop

Generated on Tue Jun 9 17:32:56 2009 for CMSSW by  doxygen 1.5.4