parameters: (self, request)
return_statement: return response
docstring: Overrides on-run-start callback.
  
      Invoke the CLI to let user choose what action to take:
        run / run --no_debug / step.
  
      Args:
        request: An instance of OnSessionInitRequest.
  
      Returns:
        An instance of OnSessionInitResponse.
  
      Raises:
        RuntimeError: If user chooses to prematurely exit the debugger.
docstring_summary: Overrides on-run-start callback.
docstring_tokens: Overrides on - run - start callback .
function: def on_run_start(self, request):
      """Overrides on-run-start callback.
  
      Invoke the CLI to let user choose what action to take:
        run / run --no_debug / step.
  
      Args:
        request: An instance of OnSessionInitRequest.
  
      Returns:
        An instance of OnSessionInitResponse.
  
      Raises:
        RuntimeError: If user chooses to prematurely exit the debugger.
      """
  
      self._update_run_calls_state(request.run_call_count, request.fetches,
                                   request.feed_dict)
  
      if self._run_till_filter_pass:
        # If we are running till a filter passes, we just need to keep running
        # with the DEBUG_RUN option.
        return framework.OnRunStartResponse(framework.OnRunStartAction.DEBUG_RUN,
                                            self._get_run_debug_urls())
  
      run_start_cli = curses_ui.CursesUI()
  
      run_start_cli.register_command_handler(
          "run",
          self._on_run_start_run_handler,
          self._on_run_start_parsers["run"].format_help(),
          prefix_aliases=["r"])
      run_start_cli.register_command_handler(
          "invoke_stepper",
          self._on_run_start_step_handler,
          self._on_run_start_parsers["invoke_stepper"].format_help(),
          prefix_aliases=["s"])
  
      if isinstance(request.fetches, list) or isinstance(request.fetches, tuple):
        fetch_lines = [fetch.name for fetch in request.fetches]
      else:
        fetch_lines = [repr(request.fetches)]
  
      if not request.feed_dict:
        feed_dict_lines = ["(Empty)"]
      else:
        feed_dict_lines = []
        for feed_key in request.feed_dict:
          feed_dict_lines.append(feed_key.name)
  
      # TODO(cais): Refactor into its own function.
      help_intro = [
          "======================================",
          "About to enter Session run() call #%d:" % request.run_call_count, "",
          "Fetch(es):"
      ]
      help_intro.extend(["  " + line for line in fetch_lines])
      help_intro.extend(["", "Feed dict(s):"])
      help_intro.extend(["  " + line for line in feed_dict_lines])
      help_intro.extend([
          "======================================", "",
          "Select one of the following commands to proceed ---->", "  run:",
          "      Execute the run() call with the debug tensor-watching",
          "  run -n:",
          "      Execute the run() call without the debug tensor-watching",
          "  run -f <filter_name>:",
          "      Keep executing run() calls until a dumped tensor passes ",
          "      a given, registered filter emerge. Registered filter(s):"
      ])
  
      if self._tensor_filters:
        filter_names = []
        for filter_name in self._tensor_filters:
          filter_names.append(filter_name)
          help_intro.append("        * " + filter_name)
  
        # Register tab completion for the filter names.
        run_start_cli.register_tab_comp_context(["run", "r"], filter_names)
      else:
        help_intro.append("        (None)")
  
      help_intro.extend(["",
                         "For more details, see help below:"
                         "",])
      run_start_cli.set_help_intro(help_intro)
  
      # Create initial screen output detailing the run.
      title = "run-start: " + self._run_description
      response = run_start_cli.run_ui(
          init_command="help", title=title, title_color="yellow")
      if response == debugger_cli_common.EXPLICIT_USER_EXIT:
        # Explicit user "exit" command leads to sys.exit(1).
        print(
            "Note: user exited from debugger CLI: sys.exit(1) called.",
            file=sys.stderr)
        sys.exit(1)
  
      return response
function_tokens: def on_run_start ( self , request ) : self . _update_run_calls_state ( request . run_call_count , request . fetches , request . feed_dict ) if self . _run_till_filter_pass : # If we are running till a filter passes, we just need to keep running # with the DEBUG_RUN option. return framework . OnRunStartResponse ( framework . OnRunStartAction . DEBUG_RUN , self . _get_run_debug_urls ( ) ) run_start_cli = curses_ui . CursesUI ( ) run_start_cli . register_command_handler ( "run" , self . _on_run_start_run_handler , self . _on_run_start_parsers [ "run" ] . format_help ( ) , prefix_aliases = [ "r" ] ) run_start_cli . register_command_handler ( "invoke_stepper" , self . _on_run_start_step_handler , self . _on_run_start_parsers [ "invoke_stepper" ] . format_help ( ) , prefix_aliases = [ "s" ] ) if isinstance ( request . fetches , list ) or isinstance ( request . fetches , tuple ) : fetch_lines = [ fetch . name for fetch in request . fetches ] else : fetch_lines = [ repr ( request . fetches ) ] if not request . feed_dict : feed_dict_lines = [ "(Empty)" ] else : feed_dict_lines = [ ] for feed_key in request . feed_dict : feed_dict_lines . append ( feed_key . name ) # TODO(cais): Refactor into its own function. help_intro = [ "======================================" , "About to enter Session run() call #%d:" % request . run_call_count , "" , "Fetch(es):" ] help_intro . extend ( [ "  " + line for line in fetch_lines ] ) help_intro . extend ( [ "" , "Feed dict(s):" ] ) help_intro . extend ( [ "  " + line for line in feed_dict_lines ] ) help_intro . extend ( [ "======================================" , "" , "Select one of the following commands to proceed ---->" , "  run:" , "      Execute the run() call with the debug tensor-watching" , "  run -n:" , "      Execute the run() call without the debug tensor-watching" , "  run -f <filter_name>:" , "      Keep executing run() calls until a dumped tensor passes " , "      a given, registered filter emerge. Registered filter(s):" ] ) if self . _tensor_filters : filter_names = [ ] for filter_name in self . _tensor_filters : filter_names . append ( filter_name ) help_intro . append ( "        * " + filter_name ) # Register tab completion for the filter names. run_start_cli . register_tab_comp_context ( [ "run" , "r" ] , filter_names ) else : help_intro . append ( "        (None)" ) help_intro . extend ( [ "" , "For more details, see help below:" "" , ] ) run_start_cli . set_help_intro ( help_intro ) # Create initial screen output detailing the run. title = "run-start: " + self . _run_description response = run_start_cli . run_ui ( init_command = "help" , title = title , title_color = "yellow" ) if response == debugger_cli_common . EXPLICIT_USER_EXIT : # Explicit user "exit" command leads to sys.exit(1). print ( "Note: user exited from debugger CLI: sys.exit(1) called." , file = sys . stderr ) sys . exit ( 1 ) return response