[PATCH 0/2] Patches to run a process from tuna
by John Kacur
These patches were written by Daniel Bristot de Oliveira
He says that he submitted them multiple times, but they were somehow dropped.
I have done a code review and tested them and am adding my SOB.
They are need for bugzilla 1235829
Please apply.
Daniel Bristot de Oliveira (2):
CLI: start a process from tuna
docs: uptade tuna.8 man page with option -r
docs/tuna.8 | 7 +++--
tuna-cmd.py | 98 ++++++++++++++++++++++++++++++++++++++++++++----------------
tuna/tuna.py | 59 ++++++++++++++++++++++++++++--------
3 files changed, 124 insertions(+), 40 deletions(-)
--
2.4.11
7 years, 11 months
[PATCH] tuna: tuna-cmd: Display usage instead of traceback -c missing args
by John Kacur
Display a usage messaage instead of a python traceback when a required
argument to the -c or --cpus is missing, or when the argument doesn't
make sense. (Such as passing a nonsense string, instead of a comma separated list of numbers)
- In function pick_op, handle the unusual but possible case where an
empty string is passed as an argument.
- Display a usage message upon ValueError when caling cpustring_to_list
when processing the -c option
This fixes various erroneous or missing input to -c, such as the
following
./tuna-cmd.py -c -P
Traceback (most recent call last):
File "./tuna-cmd.py", line 656, in <module>
main()
File "./tuna-cmd.py", line 494, in main
op_list = tuna.cpustring_to_list(a)
File "/home/jkacur/source/tuna/tuna/tuna.py", line 124, in
cpustring_to_list
ends = [ int(a, 0) for a in field.split("-") ]
ValueError: invalid literal for int() with base 0: 'P'
./tuna-cmd.py -c "" -P
Traceback (most recent call last):
File "./tuna-cmd.py", line 656, in <module>
main()
File "./tuna-cmd.py", line 493, in main
(op, a) = pick_op(a)
File "./tuna-cmd.py", line 408, in pick_op
if argument[0] in ('+', '-'):
IndexError: string index out of range
./tuna-cmd.py -c "nonesense" -P
Traceback (most recent call last):
File "./tuna-cmd.py", line 656, in <module>
main()
File "./tuna-cmd.py", line 494, in main
op_list = tuna.cpustring_to_list(a)
File "/home/jkacur/source/tuna/tuna/tuna.py", line 124, in
cpustring_to_list
ends = [ int(a, 0) for a in field.split("-") ]
ValueError: invalid literal for int() with base 0: 'nonesense'
This fixes bugzilla 1268287
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
tuna-cmd.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tuna-cmd.py b/tuna-cmd.py
index ae4f78ab7d56..3c9bfaa50bb4 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -405,6 +405,8 @@ def irq_mapper(s):
return irq_list
def pick_op(argument):
+ if argument == "":
+ return (None, argument)
if argument[0] in ('+', '-'):
return (argument[0], argument[1:])
return (None, argument)
@@ -491,7 +493,11 @@ def main():
list_config()
elif o in ("-c", "--cpus"):
(op, a) = pick_op(a)
- op_list = tuna.cpustring_to_list(a)
+ try:
+ op_list = tuna.cpustring_to_list(a)
+ except ValueError:
+ usage()
+ return
cpu_list = do_list_op(op, cpu_list, op_list)
elif o in ("-N", "--nohz_full"):
try:
--
2.4.11
7 years, 11 months
[PATCH] tuna: cpuview.py: Omit offline cpus in socket_ids list
by John Kacur
sysfy.py inserts None for offline cpus in class cpus, method reload, via
class cpu method reload.
This is potentially useful, so we don't want to change these classes.
However in cpuview.py - class cpuview, we don't want to display these
offline cpus, so we only need to recognize that the type None can be
returned and then skip over it.
This fixes Bugzilla 1036156
First detected on some ppc
./tuna-cmd.py
Traceback (most recent call last):
File "./tuna-cmd.py", line 656, in <module>
main()
File "./tuna-cmd.py", line 650, in main
app = tuna_gui.main_gui(kthreads, uthreads, cpus_filtered)
File "/home/jkacur/tuna/tuna/tuna_gui.py", line 49, in __init__
self.procview, self.irqview, cpus_filtered)
File "/home/jkacur/tuna/tuna/gui/cpuview.py", line 253, in __init__
socket_ids = [ int(id) for id in self.cpus.sockets.keys() ]
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
tuna/gui/cpuview.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tuna/gui/cpuview.py b/tuna/gui/cpuview.py
index 41a3d9bbbfc3..c84ecd739c70 100755
--- a/tuna/gui/cpuview.py
+++ b/tuna/gui/cpuview.py
@@ -250,7 +250,12 @@ class cpuview:
self.irqview = irqview
vbox = window.get_child().get_child()
- socket_ids = [ int(id) for id in self.cpus.sockets.keys() ]
+ socket_ids = []
+ for id in self.cpus.sockets.keys():
+ try:
+ socket_ids.append(int(id))
+ except TypeError: # Skip over offline cpus - type None
+ continue
socket_ids.sort()
self.nr_sockets = len(socket_ids)
--
2.4.11
7 years, 11 months
[PATCH 1/3] python-schedutils: Correct typos in usage messages
by John Kacur
Correct typos in usage messages
- "chrt" should say "pchrt"
- "taskset" should say "ptaskset"
Also update the email address for bug reports and patches.
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
pchrt.py | 4 ++--
ptaskset.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pchrt.py b/pchrt.py
index c4f1f2c5e5ec..0761792454fa 100755
--- a/pchrt.py
+++ b/pchrt.py
@@ -18,7 +18,7 @@ import os, schedutils, sys
def usage():
print '''pchrt (python-schedutils)
-usage: chrt [options] [prio] [pid | cmd [args...]]
+usage: pchrt [options] [prio] [pid | cmd [args...]]
manipulate real-time attributes of a process
-b, --batch set policy to SCHED_BATCH
-f, --fifo set policy to SCHED_FIFO
@@ -32,7 +32,7 @@ manipulate real-time attributes of a process
You must give a priority if changing policy.
-Report bugs and send patches to <acme(a)ghostprotocols.net>'''
+Report bugs and send patches to <tuna-devel(a)lists.fedorahosted.org>'''
return
def show_priority_limits(policy):
diff --git a/ptaskset.py b/ptaskset.py
index 15f0ec5bfa1f..afd18477f109 100755
--- a/ptaskset.py
+++ b/ptaskset.py
@@ -18,7 +18,7 @@ import os, schedutils, sys
def usage():
print '''ptaskset (python-schedutils)
-usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
+usage: ptaskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process
-p, --pid operate on existing given pid
--
2.4.11
8 years