def __init__(self, *args, **kwargs): super(MetaShape, self).__init__(*args, **kwargs) def attach(pair): i, name = pair def get(instance): return instance[i] def set(instance, value): instance[i] = value attr = property(get) if self._dynamic else property(get, set) setattr(self, name, attr) if hasattr(self, '_names'): do(attach, enumerate(self._names)) if self._dynamic: self.__getitem__ = lambda self, *a, **kw: getitem(self._attrs, *a, **kw)()
def generate(self): for key in self.lNames: self.lInfo[key] = {} for sel in self.lSels: cmd = ( "sqlplus -S cms_hcl_runinfo/run2009info@cms_rcms @%s %s %s %s" % (self.templ, sel, self.lNames[key], self.runNumber)) cmd = cmd.split(" ") output,err,rt = utilities.do(cmd) self.log.write(output+'\n') self.log.write(err+'\n') for o in output.split("\n"): if o=="": continue elif o=="no rows selected": continue self.lInfo[key][sel] = o break return self.saveInfo()
def generate(self): for key in self.lNames: self.lInfo[key] = {} for sel in self.lSels: cmd = ( "sqlplus -S cms_hcl_runinfo/run2009info@cms_rcms @%s %s %s %s" % (self.templ, sel, self.lNames[key], self.runNumber)) cmd = cmd.split(" ") output, err, rt = utilities.do(cmd) self.log.write(output + '\n') self.log.write(err + '\n') for o in output.split("\n"): if o == "": continue elif o == "no rows selected": continue self.lInfo[key][sel] = o break return self.saveInfo()
def main(): # input is quite redundant... inputFile = sys.argv[1] runNumber = sys.argv[2] workDir = sys.argv[3] pathToSave = workDir logFile = sys.argv[4] log = open(logFile, "w") template = "query.sql" # for logging log.write(inputFile+'\n') log.write(runNumber+'\n') log.write(workDir+'\n') log.write(inputFile+'\n') log.write(template+'\n') # 1. generate Run Info xml file dbError = "" try: log.write("Initialize Run Info DB Wrapper\n") dbWrapper = runInfo.RunInfoDBWrapper(runNumber, pathToSave, template, log) runtypestr = dbWrapper.generate() except KeyError as err: log.write("Key Error Exception was triggered\n") runtypestr = "UNKNOWN" dbError = 'RunInfoDBError' # 2. Process log.write("Process using CMSSW with RunType %s\n" % runtypestr) cmd = "cmsRun %s/hcal_dqm_local_cfg.py inputFiles=file:%s runType=%s" % ( workDir, inputFile, runtypestr) log.write("Performing "+cmd+"\n") cmd = cmd.split(" ") output,error,rt = utilities.do(cmd) error = error + dbError log.write("###Starting Output\n"+output+'\n') log.write("###Starting Error\n"+error+"\n") return rt
def main(): # input is quite redundant... inputFile = sys.argv[1] runNumber = sys.argv[2] workDir = sys.argv[3] pathToSave = workDir logFile = sys.argv[4] log = open(logFile, "w") template = "query.sql" # for logging log.write(inputFile + "\n") log.write(runNumber + "\n") log.write(workDir + "\n") log.write(inputFile + "\n") log.write(template + "\n") # 1. generate Run Info xml file dbError = "" try: log.write("Initialize Run Info DB Wrapper\n") dbWrapper = runInfo.RunInfoDBWrapper(runNumber, pathToSave, template, log) runtypestr = dbWrapper.generate() except KeyError as err: log.write("Key Error Exception was triggered\n") runtypestr = "UNKNOWN" dbError = "RunInfoDBError" # 2. Process log.write("Process using CMSSW with RunType %s\n" % runtypestr) cmd = "cmsRun %s/hcal_dqm_local_cfg.py inputFiles=file:%s runType=%s" % (workDir, inputFile, runtypestr) log.write("Performing " + cmd + "\n") cmd = cmd.split(" ") output, error, rt = utilities.do(cmd) error = error + dbError log.write("###Starting Output\n" + output + "\n") log.write("###Starting Error\n" + error + "\n") return rt