Ejemplo n.º 1
0
	def _load_avg_str(self):
		try:
			avg = getloadavg()
		except OSError:
			return 'unknown'

		max_avg = max(avg)

		if max_avg < 10:
			digits = 2
		elif max_avg < 100:
			digits = 1
		else:
			digits = 0

		return ", ".join(("%%.%df" % digits ) % x for x in avg)
	def _load_avg_str(self):
		try:
			avg = getloadavg()
		except OSError:
			return 'unknown'

		max_avg = max(avg)

		if max_avg < 10:
			digits = 2
		elif max_avg < 100:
			digits = 1
		else:
			digits = 0

		return ", ".join(("%%.%df" % digits ) % x for x in avg)
Ejemplo n.º 3
0
    def _can_add_job(self):
        max_jobs = self._max_jobs
        max_load = self._max_load

        if self._max_jobs is not True and \
         self._running_job_count() >= self._max_jobs:
            return False

        if max_load is not None and \
         (max_jobs is True or max_jobs > 1) and \
         self._running_job_count() >= 1:
            try:
                avg1, avg5, avg15 = getloadavg()
            except OSError:
                return False

            if avg1 >= max_load:
                return False

        return True
	def _can_add_job(self):
		max_jobs = self._max_jobs
		max_load = self._max_load

		if self._max_jobs is not True and \
			self._running_job_count() >= self._max_jobs:
			return False

		if max_load is not None and \
			(max_jobs is True or max_jobs > 1) and \
			self._running_job_count() >= 1:
			try:
				avg1, avg5, avg15 = getloadavg()
			except OSError:
				return False

			if avg1 >= max_load:
				return False

		return True
Ejemplo n.º 5
0
    def _can_add_job(self):
        if self._terminated_tasks:
            return False

        max_jobs = self._max_jobs
        max_load = self._max_load

        if self._max_jobs is not True and self._running_job_count(
        ) >= self._max_jobs:
            return False

        if (max_load is not None and (max_jobs is True or max_jobs > 1)
                and self._running_job_count() >= 1):
            try:
                avg1, avg5, avg15 = getloadavg()
            except OSError:
                return False

            if avg1 >= max_load:
                return False

        return True