def _set_rt(self, pid, sched, prio):
		sched_str = schedutils.schedstr(sched)
		log.debug("Setting scheduler policy to '%s' and priority to '%d' of PID '%d'."
				% (sched_str, prio, pid))
		try:
			prio_min = schedutils.get_priority_min(sched)
			prio_max = schedutils.get_priority_max(sched)
			if prio < prio_min or prio > prio_max:
				log.error("Priority for %s must be in range %d - %d. '%d' was given."
						% (sched_str, prio_min,
						prio_max, prio))
		# Workaround for old (pre-0.4) python-schedutils which raised
		# SystemError instead of OSError
		except (SystemError, OSError) as e:
			log.error("Failed to get allowed priority range: %s"
					% e)
		try:
			schedutils.set_scheduler(pid, sched, prio)
		except (SystemError, OSError) as e:
			if hasattr(e, "errno") and e.errno == errno.ESRCH:
				log.debug("Failed to set scheduling parameters of PID %d, the task vanished."
						% pid)
			else:
				log.error("Failed to set scheduling parameters of PID %d: %s"
						% (pid, e))
Exemple #2
0
 def get_priority_max(self, sched):
     return schedutils.get_priority_max(sched)
Exemple #3
0
def show_priority_limits(policy):
	print "%-32.32s: %d/%d" % ("%s min/max priority" % schedutils.schedstr(policy),
				   schedutils.get_priority_min(policy),
				   schedutils.get_priority_max(policy))
Exemple #4
0
def show_priority_limits(policy):
    print "%-32.32s: %d/%d" % ("%s min/max priority" %
                               schedutils.schedstr(policy),
                               schedutils.get_priority_min(policy),
                               schedutils.get_priority_max(policy))