Tuna throwing value error when not specified priority.
Example: tuna -t PID_OF_SOME_PROCESS -p OTHER
Here "other" not priority, but scheduler policy.
For RR and FIFO default 1, for SCHED_OTHER or SCHED_BATCH,
the priority flag doesn't add anything. For code simplicity is default rtprio value 1
for all.
After patch apply, tuna use first part of string as policy and remaining part as
priority.
All unacceptable values cause exception in schedutils library and tuna show error
Signed-off-by: Petr Oros <poros(a)redhat.com>
---
tuna/tuna.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 6dfe740..7bb8fb7 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -490,10 +490,12 @@ def thread_set_priority(tid, policy, rtprio):
def threads_set_priority(tids, parm, affect_children = False):
parms = parm.split(":")
+ rtprio = 1
policy = None
- if len(parms) != 1:
+ if parms[0].upper() in ["OTHER", "BATCH", "IDLE",
"FIFO", "RR"]:
policy = schedutils.schedfromstr("SCHED_%s" % parms[0].upper())
- rtprio = int(parms[1])
+ if len(parms) > 1:
+ rtprio = int(parms[1])
else:
rtprio = int(parms[0])
--
1.8.4.2