X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfiprocess.py;h=27c5b7c2bba25f773e86f8dea3a7bf32d0e69d92;hp=ba9a5c832636ae9073fc47f02fcdf022ac70bf31;hb=c8a31d5f8c07dd3ebb6d622752fab424a72c0c2f;hpb=e095c7423002644d129cef273f3a63646903b788 diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index ba9a5c8..27c5b7c 100644 --- a/sface/sfiprocess.py +++ b/sface/sfiprocess.py @@ -1,4 +1,7 @@ +import os +import time + from PyQt4.QtCore import * from sface.sficonfig import config @@ -16,7 +19,7 @@ class SfiProcess(QObject): def __init__(self, parent=None): QObject.__init__(self, parent) - def __init_command(self, args) + def __init_command(self, args): self.args = QStringList() for arg in args: self.args << QString(arg) @@ -24,9 +27,12 @@ class SfiProcess(QObject): self.exe = find_executable("sfi.py") self.process = QProcess() - finished = pyqtSignal() self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), - self.finished) + self.processFinished) + + def processFinished(self): + self.trace_end() + self.emit(SIGNAL("finished()")) def __getRSpec(self, mgr): slice = config.getSlice() @@ -57,9 +63,20 @@ class SfiProcess(QObject): self.start() def start(self): - self.process(self.exe, self.args) + self.trace_command() + self.process.start(self.exe, self.args) def readOutput(self): if self.process.state() == QProcess.NotRunning: return self.process.readAll() + def trace_command (self): + if config.SFACE_VERBOSE: + self._trace=time.time() + command = "%s %s" % (self.exe, self.args.join(" ")) + print time.strftime('%M:%S'),'Invoking',command + + def trace_end (self): + if config.SFACE_VERBOSE: + command = "%s %s" % (self.exe, self.args.join(" ")) + print time.strftime('%M:%S'),"[%.3f s]"%(time.time()-self._trace),command,'Done'