@classmethod
  def ClaimNotificationsForCollection(cls,
                                      token=None,
                                      start_time=None,
                                      lease_time=200,
                                      collection=None):

    class CollectionFilter(object):

      def __init__(self, collection):
        self.collection = collection

      def FilterRecord(self, notification):
        if self.collection is None:
          self.collection = notification.result_collection_urn
        return self.collection != notification.result_collection_urn

    f = CollectionFilter(collection)
    results = []
    with aff4.FACTORY.OpenWithLock(RESULT_NOTIFICATION_QUEUE,
                                   aff4_type="HuntResultQueue",
                                   lease_time=300,
                                   blocking=True,
                                   blocking_sleep_interval=15,
                                   blocking_lock_timeout=600,
                                   token=token) as queue:
      for record_id, value in queue.ClaimRecords(record_filter=f.FilterRecord,
                                                 start_time=start_time,
                                                 timeout=lease_time,
                                                 limit=100000):
        results.append((record_id, value.timestamp, value.suffix))
    return (f.collection, results)
Return unclaimed hunt result notifications for collection.
dataset/ETHPy150Open google/grr/grr/lib/hunts/results.py/HuntResultQueue.ClaimNotificationsForCollection