コード例 #1
0
	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))
コード例 #2
0
 def get_priority_max(self, sched):
     return schedutils.get_priority_max(sched)
コード例 #3
0
ファイル: pchrt.py プロジェクト: cz172638/python-schedutils
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))
コード例 #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))