コード例 #1
0
    def __init__(self):

        super(PikaRecordStream, self).__init__()

        # keep track of how many records have been streamed
        self._recordCount = 0
        self.subscriber = PikaSubscriber(_DEVICE_NAME, _DEVICE_ID, _HOST)
        self.subscriber.connect()
コード例 #2
0
 def __init__(self, device_name, device_id, host):
     self.device_name = device_name
     self.device_id = device_id
     self.host = host
     self.subscriber = PikaSubscriber(self.device_name, self.device_id,
                                      self.host)
     self.model = None
コード例 #3
0
 def __init__(self):
   
   super(PikaRecordStream, self).__init__()
   
   # keep track of how many records have been streamed
   self._recordCount = 0
   self.subscriber = PikaSubscriber(_DEVICE_NAME, _DEVICE_ID, _HOST)
   self.subscriber.connect()
コード例 #4
0
class PikaRecordStream(RecordStreamIface):
  """ 
  Pika based RecordStream implementation
  """
 
  def __init__(self):
    
    super(PikaRecordStream, self).__init__()
    
    # keep track of how many records have been streamed
    self._recordCount = 0
    self.subscriber = PikaSubscriber(_DEVICE_NAME, _DEVICE_ID, _HOST)
    self.subscriber.connect()

    
    
  def getNextRecord(self, useCache=True):
    """ 
    Returns next available data record 
   
    """
    record = self.subscriber.get_one_message()
    return record
  
  
  def close(self):
    raise NotImplementedError("not implemented")

  def rewind(self):
    raise NotImplementedError("You can't rewind when subscribing to a message queue")


  def getRecordsRange(self, **kwargs):
    raise NotImplementedError("not implemented")


  def getLastRecords(self, numRecords):
    raise NotImplementedError("not implemented")


  def removeOldData(self):
    raise NotImplementedError("not implemented")

  def appendRecord(self, record, inputBookmark=None):
    raise NotImplementedError("not implemented")

  def appendRecords(self, records, inputRef=None, progressCB=None):
    raise NotImplementedError("not implemented")


  def getBookmark(self):
    raise NotImplementedError("not implemented")


  def recordsExistAfter(self, bookmark):
   return True # we are continually listening for messages

  def seekFromEnd(self, numRecords):
    raise NotImplementedError("not implemented")

  def getStats(self):
    raise NotImplementedError("not implemented")

  def clearStats(self):
   raise NotImplementedError("not implemented")

  def getError(self):
    raise NotImplementedError("not implemented")

  def setError(self, error):
   raise NotImplementedError("not implemented")

  def isCompleted(self):
    raise NotImplementedError("not implemented")
  

  def setCompleted(self, completed=True):
    raise NotImplementedError("not implemented")
  
  
  def getFieldNames(self):
    raise NotImplementedError("not implemented")
  
  def getFields(self):
    raise NotImplementedError("not implemented")

  def getNextRecordIdx(self):
    """
    Returns the index of the record that will be read next from getNextRecord()
    """
    return self._recordCount


  def setTimeout(self, timeout):
    raise NotImplementedError("not implemented")


  def flush(self):
    raise NotImplementedError("not implemented")
コード例 #5
0
class PikaRecordStream(RecordStreamIface):
    """ 
  Pika based RecordStream implementation
  """
    def __init__(self):

        super(PikaRecordStream, self).__init__()

        # keep track of how many records have been streamed
        self._recordCount = 0
        self.subscriber = PikaSubscriber(_DEVICE_NAME, _DEVICE_ID, _HOST)
        self.subscriber.connect()

    def getNextRecord(self, useCache=True):
        """ 
    Returns next available data record 
   
    """
        record = self.subscriber.get_one_message()
        return record

    def close(self):
        raise NotImplementedError("not implemented")

    def rewind(self):
        raise NotImplementedError(
            "You can't rewind when subscribing to a message queue")

    def getRecordsRange(self, **kwargs):
        raise NotImplementedError("not implemented")

    def getLastRecords(self, numRecords):
        raise NotImplementedError("not implemented")

    def removeOldData(self):
        raise NotImplementedError("not implemented")

    def appendRecord(self, record, inputBookmark=None):
        raise NotImplementedError("not implemented")

    def appendRecords(self, records, inputRef=None, progressCB=None):
        raise NotImplementedError("not implemented")

    def getBookmark(self):
        raise NotImplementedError("not implemented")

    def recordsExistAfter(self, bookmark):
        return True  # we are continually listening for messages

    def seekFromEnd(self, numRecords):
        raise NotImplementedError("not implemented")

    def getStats(self):
        raise NotImplementedError("not implemented")

    def clearStats(self):
        raise NotImplementedError("not implemented")

    def getError(self):
        raise NotImplementedError("not implemented")

    def setError(self, error):
        raise NotImplementedError("not implemented")

    def isCompleted(self):
        raise NotImplementedError("not implemented")

    def setCompleted(self, completed=True):
        raise NotImplementedError("not implemented")

    def getFieldNames(self):
        raise NotImplementedError("not implemented")

    def getFields(self):
        raise NotImplementedError("not implemented")

    def getNextRecordIdx(self):
        """
    Returns the index of the record that will be read next from getNextRecord()
    """
        return self._recordCount

    def setTimeout(self, timeout):
        raise NotImplementedError("not implemented")

    def flush(self):
        raise NotImplementedError("not implemented")