Exemplo n.º 1
0
    def GetAttDataBetweenDates(self, argin):
        """
        Arguments to be AttrName, StartDate, StopDate, Synchronous
        
        If Synchronous is missing or False, data is buffered into attributes, which names are returned
        If True or Yes, all the data is returned when ready
        
        Data returned will be (rows,[t0,v0,t1,v1,t2,v2,...])
        """
        print time.ctime() + "In ", self.get_name(
        ), "::GetAttDataBetweenDates(%s)" % argin
        #    Add your own code here
        size = 0
        aname = argin[0]
        tag = self.attr2tag(aname)
        dates = self.dates2times(argin[1:3])
        RW = False
        synch = fn.searchCl('yes|true', str(argin[3:4]))
        attrs = [tag, tag + '_r', tag + '_w', tag +
                 '_t'] if RW else [tag, tag + '_r', tag + '_w', tag + '_t']

        self.reader.get_attribute_values(
            aname, (lambda v: self.reader_hook(aname, v)),
            dates[0],
            dates[1],
            decimate=True,
            cache=self.UseApiCache)
        self.counter += 1
        print(self.counter)

        argout = [fn.shape(attrs), [a for a in attrs]]

        if not synch:
            print '\t%s' % argout
            return argout

        else:
            while not self.IsDataReady(aname):
                fandango.wait(0.1)
            data = self.AttrData[aname][-1]
            for t, v in data:
                argout.append(t)
                argout.extend(fn.toSequence(v))
            return [fn.shape(data), argout]
Exemplo n.º 2
0
 def GetAttDataBetweenDates(self, argin):
     """
     Arguments to be AttrName, StartDate, StopDate, Synchronous
     
     If Synchronous is missing or False, data is buffered into attributes, which names are returned
     If True or Yes, all the data is returned when ready
     
     Data returned will be (rows,[t0,v0,t1,v1,t2,v2,...])
     """
     print time.ctime()+"In ", self.get_name(), "::GetAttDataBetweenDates(%s)"%argin
     #    Add your own code here
     size = 0
     aname = argin[0]
     tag = self.attr2tag(aname)
     dates = self.dates2times(argin[1:3])
     RW = False
     synch = fn.searchCl('yes|true',str(argin[3:4]))
     attrs = [tag,tag+'_r',tag+'_w',tag+'_t'] if RW else [tag,tag+'_r',tag+'_w',tag+'_t']
     
     self.reader.get_attribute_values(aname,
         (lambda v: self.reader_hook(aname,v)),dates[0],dates[1],
         decimate=True, cache=self.UseApiCache)
     self.counter+=1
     print(self.counter)
     
     argout = [fn.shape(attrs),[a for a in attrs]]
     
     if not synch:
       print '\t%s'%argout
       return argout
   
     else:
       while not self.IsDataReady(aname):
         fandango.wait(0.1)
       data = self.AttrData[aname][-1]
       for t,v in data:
         argout.append(t)
         argout.extend(fn.toSequence(v))
       return [fn.shape(data),argout]