parameters: (self, bot_platform, cfg_file_path, arguments)
return_statement: return (SUCCESS, rietveld_url)
docstring: Updates perf config file, uploads changes and excutes perf try job.
  
      Args:
        bot_platform: Name of the platform to be generated.
        cfg_file_path: Perf config file path.
  
      Returns:
        (result, msg) where result is one of:
            SUCCESS if a tryjob was sent
            NO_CHANGES if there was nothing to try,
            ERROR if a tryjob was attempted but an error encountered
            and msg is an error message if an error was encountered, or rietveld
            url if success, otherwise throws TrybotError exception.
docstring_summary: Updates perf config file, uploads changes and excutes perf try job.
docstring_tokens: Updates perf config file uploads changes and excutes perf try job .
function: def _UpdateConfigAndRunTryjob(self, bot_platform, cfg_file_path, arguments):
      """Updates perf config file, uploads changes and excutes perf try job.
  
      Args:
        bot_platform: Name of the platform to be generated.
        cfg_file_path: Perf config file path.
  
      Returns:
        (result, msg) where result is one of:
            SUCCESS if a tryjob was sent
            NO_CHANGES if there was nothing to try,
            ERROR if a tryjob was attempted but an error encountered
            and msg is an error message if an error was encountered, or rietveld
            url if success, otherwise throws TrybotError exception.
      """
      config = self._GetPerfConfig(bot_platform, arguments)
      config_to_write = 'config = %s' % json.dumps(
          config, sort_keys=True, indent=2, separators=(',', ': '))
  
      try:
        with open(cfg_file_path, 'r') as config_file:
          if config_to_write == config_file.read():
            return NO_CHANGES, ''
      except IOError:
        msg = 'Cannot find %s. Please run from src dir.' % cfg_file_path
        return (ERROR, msg)
  
      with open(cfg_file_path, 'w') as config_file:
        config_file.write(config_to_write)
      # Commit the config changes locally.
      returncode, out, err = _RunProcess(
          [_GIT_CMD, 'commit', '-a', '-m', 'bisect config: %s' % bot_platform])
      if returncode:
        raise TrybotError('Could not commit bisect config change for %s,'
                          ' error %s' % (bot_platform, err))
      # Upload the CL to rietveld and run a try job.
      returncode, out, err = _RunProcess([
          _GIT_CMD, 'cl', 'upload', '-f', '--bypass-hooks', '-m',
          'CL for perf tryjob on %s' % bot_platform
      ])
      if returncode:
        raise TrybotError('Could not upload to rietveld for %s, error %s' %
                          (bot_platform, err))
  
      match = re.search(r'https://codereview.chromium.org/[\d]+', out)
      if not match:
        raise TrybotError('Could not upload CL to rietveld for %s! Output %s' %
                          (bot_platform, out))
      rietveld_url = match.group(0)
      # Generate git try command for available bots.
      git_try_command = [_GIT_CMD, 'cl', 'try', '-m', 'tryserver.chromium.perf']
      for bot in self._builder_names[bot_platform]:
        git_try_command.extend(['-b', bot])
      returncode, out, err = _RunProcess(git_try_command)
      if returncode:
        raise TrybotError('Could not try CL for %s, error %s' %
                          (bot_platform, err))
  
      return (SUCCESS, rietveld_url)
function_tokens: def _UpdateConfigAndRunTryjob ( self , bot_platform , cfg_file_path , arguments ) : config = self . _GetPerfConfig ( bot_platform , arguments ) config_to_write = 'config = %s' % json . dumps ( config , sort_keys = True , indent = 2 , separators = ( ',' , ': ' ) ) try : with open ( cfg_file_path , 'r' ) as config_file : if config_to_write == config_file . read ( ) : return NO_CHANGES , '' except IOError : msg = 'Cannot find %s. Please run from src dir.' % cfg_file_path return ( ERROR , msg ) with open ( cfg_file_path , 'w' ) as config_file : config_file . write ( config_to_write ) # Commit the config changes locally. returncode , out , err = _RunProcess ( [ _GIT_CMD , 'commit' , '-a' , '-m' , 'bisect config: %s' % bot_platform ] ) if returncode : raise TrybotError ( 'Could not commit bisect config change for %s,' ' error %s' % ( bot_platform , err ) ) # Upload the CL to rietveld and run a try job. returncode , out , err = _RunProcess ( [ _GIT_CMD , 'cl' , 'upload' , '-f' , '--bypass-hooks' , '-m' , 'CL for perf tryjob on %s' % bot_platform ] ) if returncode : raise TrybotError ( 'Could not upload to rietveld for %s, error %s' % ( bot_platform , err ) ) match = re . search ( r'https://codereview.chromium.org/[\d]+' , out ) if not match : raise TrybotError ( 'Could not upload CL to rietveld for %s! Output %s' % ( bot_platform , out ) ) rietveld_url = match . group ( 0 ) # Generate git try command for available bots. git_try_command = [ _GIT_CMD , 'cl' , 'try' , '-m' , 'tryserver.chromium.perf' ] for bot in self . _builder_names [ bot_platform ] : git_try_command . extend ( [ '-b' , bot ] ) returncode , out , err = _RunProcess ( git_try_command ) if returncode : raise TrybotError ( 'Could not try CL for %s, error %s' % ( bot_platform , err ) ) return ( SUCCESS , rietveld_url )