def _initDS(self):
     '''Initialises all DataSync, Queue and timestamping containers and begin check process'''
     self.ioq = {etft:None for etft in FEEDS.values()}
     self.ds = {etft:None for etft in FEEDS.values()}
     self.stamp = {etft:time.time() for etft in FEEDS.values()}
     
     #init the g2+a2+a1 different feed threads
     self.dsr = {f:DataSyncFeeds for f in FIRST.values()}
     self.dsr[FeedRef((FeatureType.ADDRESS,FeedType.FEATURES))] = DataSyncFeatures
     #Users feed not included in DSR for Release1.0
     for etft in self._start: self._checkDS(etft)
 def response(self,etft=FeedRef((FeatureType.ADDRESS,FeedType.RESOLUTIONFEED))):
     '''Returns any features lurking in the response queue
     - Response queue contains esponses to user generated requests
     @param etft: FeedRef of response thread. Default=Address/Resolution
     @type etft: FeedRef
     @return: Feature
     '''
     resp = ()
     delflag = False
     #while self.ioq.has_key((et,ft)) and not self.ioq[(et,ft)]['resp'].empty():
     while etft in FEEDS.values() and not self.ioq[etft]['resp'].empty():
         resp += (self.ioq[etft]['resp'].get(),)
         #don't delete the queue while we're still getting items from it, instead mark it for deletion
         if etft in FEED0.values(): delflag = True
     if delflag: self._cullDS(etft)
     return resp
Exemple #3
0
 def __init__(self,params,queues):
     '''Initialise new DataSync object splitting out config parameters
     @param params: List of configuration parameters
     @type params: List<?>
     @param queues: List of IOR queues
     @type queues: Dict<String,Queue.Queue>        
     '''
     #from DataManager import FEEDS
     super(DataSync,self).__init__()
     #thread reference, ft to AD/CF/RF, config info
     self.start_time = time.time()
     self.updater_running = False
     self.ref,self.etft,self.ftracker,self.conf = params
     self.data_hash = {dh:0 for dh in FEEDS.values()}
     self.factory = FeatureFactory.getInstance(self.etft)
     self.updater = DataUpdater.getInstance(self.etft) # unevaluated class
     self.inq = queues['in']
     self.outq = queues['out']
     self.respq = queues['resp']
 def _initADL(self):
     '''Read ADL from serial and update from API'''
     return {f:[] for f in FEEDS.values()}