예제 #1
0
파일: TCEQadaptor.py 프로젝트: twdb/txhis
 def __init__(self, adtName, srcConfName, pipeConfName, sinkConfName, logConfName=config[0], firstTimeRun=True):
     self.adtName = adtName
     self.firstTimeRun = firstTimeRun
     # assert not logConfName
     # get log config parameter dictionary
     self.logList = []
     # initialize log(s) according to parameters.
     log_args = get_conf_attr(logConfName)
     for attDict in log_args:
         reticLog.addLogger(self.logList, attDict)
     # source object
     self.adaptorSource = HTTPSource.source(get_conf_attr(srcConfName, "source"), self.logList)
     self.interval = self.adaptorSource.interval
     # no pipe object for TCEQ
     # sink obj
     self.adaptorSink = SQLSink_forTCEQ.sink(get_conf_attr(sinkConfName, "sink"), self.logList)
예제 #2
0
파일: TPWDadaptor.py 프로젝트: twdb/txhis
 def __init__(self, adtName,
                    srcConfName,pipeConfName,sinkConfName,
                    logConfName = config[0]):
     self.adtName = adtName
     #assert not logConfName
     #get log config parameter dictionary         
     self.logList = []
     #initialize log(s) according to parameters.
     log_args = get_conf_attr(logConfName)
     for attDict in log_args:
         reticLog.addLogger(self.logList,attDict)
     #source object
     
     self.adaptorSource = fileSource.source(get_conf_attr(srcConfName,'source'),self.logList)
     self.interval = self.adaptorSource.interval
     #pipe object
     self.adaptorPipe = toXML.pipe(get_conf_attr(pipeConfName,'pipe'),self.logList)
     #sink obj
     self.adaptorSink = SQLSink_forTPWD.sink(get_conf_attr(sinkConfName,'sink'),self.logList)      
예제 #3
0
        elif tabFlag == 'DV':
            try:
                column = testTPWDmodel.DataValues.ValueID.property.columns[0]
                maxid = (self.session.query(func.max(column)).one()[0]) + 1
            except Exception:
                pass
        return maxid

if __name__ == '__main__':
    import time
    #place starting time stub
    start = time.clock()
    print 'testing sink....'
    config = ["..\\testAdaptor_config\\logParam.xml","..\\testAdaptor_config\\sinkParam.xml"]
    #get log config parameter dictionary 
    log_args = get_conf_attr(config[0])
    #logList parameter, parameter for source, pipe and sink
    logList = []
    #initialize log(s) according to parameters.
    for attDict in log_args:
         reticLog.addLogger(logList,attDict)
    #initialize sink 
    sink_args = get_conf_attr(config[1],'sink')   #get sink parameters
    testSink = sink(sink_args,logList)            #actual initialization
    #get the message, here we get the "dummy message" from an xml file for test purposes
    dummyPipe = file('..\\pipes\\test_TPWD_Emat_out.xml','r')  
    testSink.getMsg(dummyPipe.read())
    recordList = testSink.getRecordList()
    raw_input(str(len(recordList))+" XML records"+' generated')
    testSink.processSites(recordList)
    print "yeah, sites info processed......"