class_docstr: Debugger V2 Plugin for TensorBoard.
class_docstr_tok: ["Debugger","V2","Plugin","for","TensorBoard","."]
docstr: Serves the content of a given source file.
  
  The source file is referred to by the index in the list of all source
  files involved in the execution of the debugged program, which is
  available via the `serve_source_files_list()`  serving route.
  
  Args:
    request: HTTP request.
  
  Returns:
    Response to the request.
docstr_tok: ["Serves","the","content","of","a","given","source","file",".","The","source","file","is","referred","to","by","the","index","in","the","list","of","all","source","files","involved","in","the","execution","of","the","debugged","program",",","which","is","available","via","the","`","serve_source_files_list","(",")","`","serving","route",".","Args",":","request",":","HTTP","request",".","Returns",":","Response","to","the","request","."]
code: def serve_source_file(self, request):
      """Serves the content of a given source file.
  
      The source file is referred to by the index in the list of all source
      files involved in the execution of the debugged program, which is
      available via the `serve_source_files_list()`  serving route.
  
      Args:
        request: HTTP request.
  
      Returns:
        Response to the request.
      """
      experiment = plugin_util.experiment_id(request.environ)
      run = request.args.get("run")
      if run is None:
          return _missing_run_error_response(request)
      index = request.args.get("index")
      # TOOD(cais): When the need arises, support serving a subset of a
      # source file's lines.
      if index is None:
          return _error_response(
              request, "index is not provided for source file content"
          )
      index = int(index)
      run_tag_filter = debug_data_provider.source_file_run_tag_filter(
          run, index
      )
      blob_sequences = self._data_provider.read_blob_sequences(
          experiment_id=experiment,
          plugin_name=self.plugin_name,
          run_tag_filter=run_tag_filter,
      )
      tag = next(iter(run_tag_filter.tags))
      try:
          return http_util.Respond(
              request,
              self._data_provider.read_blob(
                  blob_key=blob_sequences[run][tag][0].blob_key
              ),
              "application/json",
          )
      except errors.NotFoundError as e:
          return _error_response(request, str(e))
  
imports: import threading
  from werkzeug import wrappers
  from tensorboard import errors
  from tensorboard import plugin_util
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.debugger_v2 import debug_data_provider
  from tensorboard.backend import http_util
label_desc: Use image node_id 15 for calling the DebuggerV2Plugin obj's underlying member method code with example usage: obj.serve_source_file(request) and returns: _missing_run_error_response, _error_response, http_util, _error_response