parameters: (self)
return_statement: return self.__options.jobs
docstring: Tune the jobs num.
docstring_summary: Tune the jobs num.
docstring_tokens: Tune the jobs num .
function: def tune_parallel_jobs_num(self):
          """Tune the jobs num. """
          user_jobs_num = self.__options.jobs
          jobs_num = 0
          cpu_core_num = cpu_count()
          distcc_enabled = configparse.blade_config.get_config('distcc_config')['enabled']
  
          if distcc_enabled and self.build_environment.distcc_env_prepared:
              jobs_num = int(1.5 * len(self.build_environment.get_distcc_hosts_list())) + 1
              if jobs_num > 20:
                  jobs_num = 20
              if jobs_num and self.__options.jobs != jobs_num:
                  self.__options.jobs = jobs_num
          elif self.__options.jobs < 1:
              if cpu_core_num <= 4:
                  self.__options.jobs = 2 * cpu_core_num
              else:
                  self.__options.jobs = cpu_core_num
                  if self.__options.jobs > 8:
                      self.__options.jobs = 8
          if self.__options.jobs != user_jobs_num:
              console.info('tunes the parallel jobs number(-j N) to be %d' % (
                  self.__options.jobs))
          return self.__options.jobs
function_tokens: def tune_parallel_jobs_num ( self ) : user_jobs_num = self . __options . jobs jobs_num = 0 cpu_core_num = cpu_count ( ) distcc_enabled = configparse . blade_config . get_config ( 'distcc_config' ) [ 'enabled' ] if distcc_enabled and self . build_environment . distcc_env_prepared : jobs_num = int ( 1.5 * len ( self . build_environment . get_distcc_hosts_list ( ) ) ) + 1 if jobs_num > 20 : jobs_num = 20 if jobs_num and self . __options . jobs != jobs_num : self . __options . jobs = jobs_num elif self . __options . jobs < 1 : if cpu_core_num <= 4 : self . __options . jobs = 2 * cpu_core_num else : self . __options . jobs = cpu_core_num if self . __options . jobs > 8 : self . __options . jobs = 8 if self . __options . jobs != user_jobs_num : console . info ( 'tunes the parallel jobs number(-j N) to be %d' % ( self . __options . jobs ) ) return self . __options . jobs