class_docstr: A class used for accessing tfdbg v2 DebugEvent data on local filesystem.
  
  This class is a short-term hack, mirroring the EventMultiplexer for the main
  TensorBoard plugins (e.g., scalar, histogram and graphs.) As such, it only
  implements the methods relevant to the Debugger V2 pluggin.
  
  TODO(cais): Integrate it with EventMultiplexer and use the integrated class
  from MultiplexerDataProvider for a single path of accessing debugger and
  non-debugger data.
docstr: Get alerts from the debugged TensorFlow program.
  
  Args:
    run: The tfdbg2 run to get Alerts from.
    begin: Beginning alert index.
    end: Ending alert index.
    alert_type_filter: Optional filter string for alert type, used to
      restrict retrieved alerts data to a single type. If used,
      `begin` and `end` refer to the beginning and ending indices within
      the filtered alert type.
docstr_tok: ["Get","alerts","from","the","debugged","TensorFlow","program",".","Args",":","run",":","The","tfdbg2","run","to","get","Alerts","from",".","begin",":","Beginning","alert","index",".","end",":","Ending","alert","index",".","alert_type_filter",":","Optional","filter","string","for","alert","type",",","used","to","restrict","retrieved","alerts","data","to","a","single","type",".","If","used",",","`","begin","`","and","`","end","`","refer","to","the","beginning","and","ending","indices","within","the","filtered","alert","type","."]
code: def Alerts(self, run, begin, end, alert_type_filter=None):
      """Get alerts from the debugged TensorFlow program.
  
      Args:
        run: The tfdbg2 run to get Alerts from.
        begin: Beginning alert index.
        end: Ending alert index.
        alert_type_filter: Optional filter string for alert type, used to
          restrict retrieved alerts data to a single type. If used,
          `begin` and `end` refer to the beginning and ending indices within
          the filtered alert type.
      """
      from tensorflow.python.debug.lib import debug_events_monitors
  
      runs = self.Runs()
      if run not in runs:
          # TODO(cais): This should generate a 400 response instead.
          return None
      alerts = []
      alerts_breakdown = dict()
      alerts_by_type = dict()
      for monitor in self._monitors:
          monitor_alerts = monitor.alerts()
          if not monitor_alerts:
              continue
          alerts.extend(monitor_alerts)
          # TODO(cais): Replace this with Alert.to_json() when
          # monitor.alert_type() is available.
          if isinstance(monitor, debug_events_monitors.InfNanMonitor):
              alert_type = "InfNanAlert"
          else:
              alert_type = "__MiscellaneousAlert__"
          alerts_breakdown[alert_type] = len(monitor_alerts)
          alerts_by_type[alert_type] = monitor_alerts
      num_alerts = len(alerts)
      if alert_type_filter is not None:
          if alert_type_filter not in alerts_breakdown:
              raise errors.InvalidArgumentError(
                  "Filtering of alerts failed: alert type %s does not exist"
                  % alert_type_filter
              )
          alerts = alerts_by_type[alert_type_filter]
      end = self._checkBeginEndIndices(begin, end, len(alerts))
      return {
          "begin": begin,
          "end": end,
          "alert_type": alert_type_filter,
          "num_alerts": num_alerts,
          "alerts_breakdown": alerts_breakdown,
          "per_type_alert_limit": DEFAULT_PER_TYPE_ALERT_LIMIT,
          "alerts": [
              _alert_to_json(alert) for alert in alerts[begin:end]
          ],
      }
  
imports: import threading
  from tensorboard import errors
label_desc: Use image node_id 8 for calling the DebuggerV2EventMultiplexer obj's underlying member method code with example usage: obj.Alerts(run, begin, end, alert_type_filter) and returns: dict, None