class_docstr: Dispatch alerts to the alert processor.
class_docstr_tok: ["Dispatch","alerts","to","the","alert","processor","."]
docstr: Returns a generator that yields Alert instances triggered from the given rule name.
  
  To limit memory consumption, the generator yields a maximum number of alerts, defined
  by self._alert_generator_limit.
docstr_tok: ["Returns","a","generator","that","yields","Alert","instances","triggered","from","the","given","rule","name",".","To","limit","memory","consumption",",","the","generator","yields","a","maximum","number","of","alerts",",","defined","by","self._alert_generator_limit","."]
code: def _alert_generator(self, rule_name):
      """
      Returns a generator that yields Alert instances triggered from the given rule name.
  
      To limit memory consumption, the generator yields a maximum number of alerts, defined
      by self._alert_generator_limit.
      """
      generator = self.table.get_alert_records(
          rule_name, self.alert_proc_timeout
      )
      for idx, record in enumerate(generator, start=1):
          try:
              yield Alert.create_from_dynamo_record(record)
          except AlertCreationError:
              LOGGER.exception("Invalid alert record %s", record)
              continue
  
          if idx >= self._alert_generator_limit:
              LOGGER.warning(
                  'Alert Merger reached alert limit of %d for rule "%s"',
                  self._alert_generator_limit,
                  rule_name,
              )
              return
  
file_path: streamalert/streamalert/alert_merger/main.py
imports: from datetime import datetime
  import json
  import os
  import boto3
  from streamalert.shared.alert import Alert, AlertCreationError
  from streamalert.shared.alert_table import AlertTable
  from streamalert.shared.logger import get_logger
  from streamalert.shared.metrics import ALERT_MERGER_NAME, MetricLogger
label_desc: Use image node_id 3 for calling the AlertMerger obj's underlying member method code with example usage: obj._alert_generator(rule_name) without return types