Discussion:
[PATCH v3 1/2] CLI: fix traceback due unavailable display
Petr Oros
2013-12-04 09:38:40 UTC
Permalink
Tuna showing traceback when user haven't set DISPLAY variable and using CLI with param -l.
This is caused by gtk library which try create "window", but in CLI mode is not neccesary.
Patch remove unnecesary library which cause this problem

Signed-off-by: Petr Oros <poros at redhat.com>
---
tuna/config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tuna/config.py b/tuna/config.py
index e446447..77cc4d8 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -1,5 +1,5 @@
import io, os, re, fnmatch
-import sys, gtk, pygtk
+import sys, pygtk
import codecs, ConfigParser
from time import localtime, strftime
from subprocess import Popen, PIPE, STDOUT, call
--
1.8.4.2
Petr Oros
2013-12-04 09:38:41 UTC
Permalink
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 OTHER and BATCH default 0.
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 at redhat.com>
---
tuna/tuna.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tuna/tuna.py b/tuna/tuna.py
index 6dfe740..0feb521 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -490,10 +490,14 @@ def thread_set_priority(tid, policy, rtprio):

def threads_set_priority(tids, parm, affect_children = False):
parms = parm.split(":")
+ rtprio = 0
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])
+ elif parms[0].upper() in ["FIFO", "RR"]:
+ rtprio = 1
else:
rtprio = int(parms[0])
--
1.8.4.2
Jiri Kastner
2014-01-30 11:24:02 UTC
Permalink
tested, looks ok for me too.
j.
Post by Petr Oros
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 OTHER and BATCH default 0.
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 at redhat.com>
---
tuna/tuna.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 6dfe740..0feb521 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
parms = parm.split(":")
+ rtprio = 0
policy = None
policy = schedutils.schedfromstr("SCHED_%s" % parms[0].upper())
- rtprio = int(parms[1])
+ rtprio = int(parms[1])
+ rtprio = 1
rtprio = int(parms[0])
--
1.8.4.2
_______________________________________________
tuna-devel mailing list
tuna-devel at lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/tuna-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/tuna-devel/attachments/20140130/9b30ba36/attachment.sig>
Jiri Kastner
2014-01-30 11:23:27 UTC
Permalink
tested, looks ok for me.
j.
Post by Petr Oros
Tuna showing traceback when user haven't set DISPLAY variable and using CLI with param -l.
This is caused by gtk library which try create "window", but in CLI mode is not neccesary.
Patch remove unnecesary library which cause this problem
Signed-off-by: Petr Oros <poros at redhat.com>
---
tuna/config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tuna/config.py b/tuna/config.py
index e446447..77cc4d8 100644
--- a/tuna/config.py
+++ b/tuna/config.py
@@ -1,5 +1,5 @@
import io, os, re, fnmatch
-import sys, gtk, pygtk
+import sys, pygtk
import codecs, ConfigParser
from time import localtime, strftime
from subprocess import Popen, PIPE, STDOUT, call
--
1.8.4.2
_______________________________________________
tuna-devel mailing list
tuna-devel at lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/tuna-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/tuna-devel/attachments/20140130/64388950/attachment.sig>
Loading...