class_docstr: Provides convenience methods for accessing and modifying the alerts table.
docstr: Find all alerts for the given rule which need to be dispatched to the alert processor.
  
  Args:
      rule_name (str): Select all alerts from this rule name
      alert_proc_timeout_sec (int): Alert processor timeout
          This is used to determine whether an alert could still be in progress
  
  Yields:
      dict: Each row in the Dynamo table which is not being worked on by the alert processor.
docstr_tok: ["Find","all","alerts","for","the","given","rule","which","need","to","be","dispatched","to","the","alert","processor",".","Args",":","rule_name","(","str",")",":","Select","all","alerts","from","this","rule","name","alert_proc_timeout_sec","(","int",")",":","Alert","processor","timeout","This","is","used","to","determine","whether","an","alert","could","still","be","in","progress","Yields",":","dict",":","Each","row","in","the","Dynamo","table","which","is","not","being","worked","on","by","the","alert","processor","."]
code: def get_alert_records(self, rule_name, alert_proc_timeout_sec):
      """Find all alerts for the given rule which need to be dispatched to the alert processor.
  
      Args:
          rule_name (str): Select all alerts from this rule name
          alert_proc_timeout_sec (int): Alert processor timeout
              This is used to determine whether an alert could still be in progress
  
      Yields:
          dict: Each row in the Dynamo table which is not being worked on by the alert processor.
      """
      # Any alert which was recently dispatched to the alert processor may still be in progress,
      # so we'll skip over those for now.
      in_progress_threshold = datetime.utcnow() - timedelta(
          seconds=alert_proc_timeout_sec
      )
  
      kwargs = {
          # We need a consistent read here in order to pick up the most recent updates from the
          # alert processor. Otherwise, deleted/updated alerts may not yet have propagated.
          "ConsistentRead": True,
          # Include only those alerts which have not yet dispatched or were dispatched more than
          # ALERT_PROCESSOR_TIMEOUT seconds ago.
          "FilterExpression": (
              Attr("Dispatched").lt(
                  in_progress_threshold.strftime(Alert.DATETIME_FORMAT)
              )
          ),
          "KeyConditionExpression": Key("RuleName").eq(rule_name),
      }
      for item in self._paginate(self._table.query, kwargs):
          yield item
  
file_path: streamalert/streamalert/shared/alert_table.py
imports: from datetime import datetime, timedelta
  import boto3
  from boto3.dynamodb.conditions import Attr, Key
  from streamalert.shared.alert import Alert
  from streamalert.shared.helpers.dynamodb import ignore_conditional_failure
label_desc: Use image node_id 5 for calling the AlertTable obj's underlying member method code with example usage: obj.get_alert_records(rule_name, alert_proc_timeout_sec) without return types