Skip to content

Commit

Permalink
Use tabs instead of spaces
Browse files Browse the repository at this point in the history
And remove needless debug print.
  • Loading branch information
syohex committed Dec 27, 2015
1 parent 681a83b commit e75add3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ros/src/util/packages/runtime_manager/scripts/proc_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def set_nice(self, pid, value):
return 0

def set_cpu_affinity(self, pid, cpus):
try:
proc = psutil.Process(pid)
except psutil.NoSuchProcess as e:
return
try:
proc = psutil.Process(pid)
except psutil.NoSuchProcess as e:
return

print("[CPU affinity] Set pid:{}, CPUS: {}: ".format(proc.pid, cpus))

Expand All @@ -89,17 +89,17 @@ def set_cpu_affinity(self, pid, cpus):

def _policy_to_string(self, policy):
if policy == 0:
return "SCHED_OTHER"
elif policy == 1:
return "SCHED_FIFO"
elif policy == 2:
return "SCHED_RR"
else:
raise ValueError("Invalid schedule policy argument")
return "SCHED_OTHER"
elif policy == 1:
return "SCHED_FIFO"
elif policy == 2:
return "SCHED_RR"
else:
raise ValueError("Invalid schedule policy argument")

def set_scheduling_policy(self, pid, policy, priority):
print("[sched_setscheduler] pid={}, priority={} ".format(
pid, self._policy_to_string(policy), priority))
pid, self._policy_to_string(policy), priority))

param = ctypes.c_int(priority)
err = libc.sched_setscheduler(pid, ctypes.c_int(policy), ctypes.byref(param))
Expand All @@ -112,7 +112,7 @@ def run(self):

order = yaml.load(data)
ret = 0
print("Got: {}".format(order['name']))

if order['name'] == 'nice':
ret = self.set_nice(order['pid'], order['nice'])
elif order['name'] == 'cpu_affinity':
Expand Down

0 comments on commit e75add3

Please sign in to comment.