From 6e2b99a0870e467e35c8b4b95aeb1e665dded413 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Thu, 21 Feb 2013 18:32:24 -0500 Subject: Many bugfixes motivated by some end-to-end testing. --- run/executable/executable.py | 9 +++++---- run/executable/ftcat.py | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'run/executable') diff --git a/run/executable/executable.py b/run/executable/executable.py index bc8edd7..0a408b7 100644 --- a/run/executable/executable.py +++ b/run/executable/executable.py @@ -44,7 +44,6 @@ class Executable(object): return full_command def __str__(self): - print("Full command: %s" % self.__get_full_command()) return " ".join(self.__get_full_command()) def execute(self): @@ -63,7 +62,7 @@ class Executable(object): '''Send the terminate signal to the binary.''' self.sp.terminate() - def wait(self): + def wait(self, error=True): '''Wait until the executable is finished, checking return code. If the exit status is non-zero, raise an exception. @@ -71,8 +70,10 @@ class Executable(object): ''' self.sp.wait() - if self.sp.returncode != 0: - print >>sys.stderr, "Non-zero return: %s %s" % (self.exec_file, " ".join(self.extra_args)) + if self.sp.returncode != 0 and error: + print >>sys.stderr, "Non-zero return %d: %s %s" % (self.sp.returncode, + self.exec_file, + " ".join(self.extra_args)) return 0 else: return 1 diff --git a/run/executable/ftcat.py b/run/executable/ftcat.py index 5da8fa7..1f0420b 100644 --- a/run/executable/ftcat.py +++ b/run/executable/ftcat.py @@ -1,18 +1,15 @@ import os import stat -from executable import Executable +from .executable import Executable class FTcat(Executable): '''Used to wrap the ftcat binary in the Experiment object.''' def __init__(self, ft_cat_bin, stdout_file, stderr_file, dev, events, cpu=None): '''Extends the Executable initializer method with ftcat attributes.''' + super(FTcat, self).__init__('/usr/bin/taskset') - # hack to run FTCat at higher priority - chrt_bin = '/usr/bin/chrt' - - super(FTcat, self).__init__(chrt_bin) self.stdout_file = stdout_file self.stderr_file = stderr_file @@ -23,11 +20,15 @@ class FTcat(Executable): if events is None: raise Exception('No events!') - # hack to run FTCat at higher priority - self.extra_args = ['-f', '40'] if cpu is not None: - # and bind it to a CPU - self.extra_args.extend(['/usr/bin/taskset', '-c', str(cpu)]) + # Execute only on the given CPU + self.extra_args = ['-c', str(cpu)] + else: + # Execute on any cpu + self.extra_args = ['0xFFFFFFFF'] + events_str_arr = map(str, events) - self.extra_args.extend([ft_cat_bin, dev] + events_str_arr) + ft_cat_cmd = [ft_cat_bin, dev] + list(events_str_arr) + + self.extra_args.extend(ft_cat_cmd) -- cgit v1.2.2