class_docstr: Orchestrates delivery of alerts to the appropriate dispatchers.
class_docstr_tok: ["Orchestrates","delivery","of","alerts","to","the","appropriate","dispatchers","."]
docstr: Run the alert processor!
  
  Args:
      event (dict): Lambda invocation event containing at least the rule name and alert ID.
  
  Returns:
      dict: Maps output (str) to whether it sent successfully (bool).
          An empty dict is returned if the Alert was improperly formatted.
docstr_tok: ["Run","the","alert","processor","!","Args",":","event","(","dict",")",":","Lambda","invocation","event","containing","at","least","the","rule","name","and","alert","ID",".","Returns",":","dict",":","Maps","output","(","str",")","to","whether","it","sent","successfully","(","bool",")",".","An","empty","dict","is","returned","if","the","Alert","was","improperly","formatted","."]
code: def run(self, event):
      """Run the alert processor!
  
      Args:
          event (dict): Lambda invocation event containing at least the rule name and alert ID.
  
      Returns:
          dict: Maps output (str) to whether it sent successfully (bool).
              An empty dict is returned if the Alert was improperly formatted.
      """
      # Grab the alert record from Dynamo (if needed).
      if set(event) == {"AlertID", "RuleName"}:
          LOGGER.info("Retrieving %s from alerts table", event)
          alert_record = self.alerts_table.get_alert_record(
              event["RuleName"], event["AlertID"]
          )
          if not alert_record:
              LOGGER.error(
                  "%s does not exist in the alerts table", event
              )
              return {}
      else:
          alert_record = event
  
      # Convert record to an Alert instance.
      try:
          alert = Alert.create_from_dynamo_record(alert_record)
      except AlertCreationError:
          LOGGER.exception("Invalid alert %s", event)
          return {}
  
      # Remove normalization key from the record.
      # TODO: Consider including this in at least some outputs, e.g. default Athena firehose
      if Normalizer.NORMALIZATION_KEY in alert.record:
          del alert.record[Normalizer.NORMALIZATION_KEY]
  
      result = self._send_to_outputs(alert)
      self._update_table(alert, result)
      return result
  
file_path: streamalert/streamalert/alert_processor/main.py
imports: from os import environ
  import backoff
  from botocore.exceptions import ClientError
  from streamalert.alert_processor.outputs.output_base import StreamAlertOutput
  from streamalert.shared import backoff_handlers, resources
  from streamalert.shared.alert import Alert, AlertCreationError
  from streamalert.shared.alert_table import AlertTable
  from streamalert.shared.config import load_config
  from streamalert.shared.logger import get_logger
  from streamalert.shared.normalize import Normalizer
label_desc: Use image node_id 6 for calling the AlertProcessor obj's underlying member method code with example usage: obj.run(event) and returns: result, dict, dict