def run( self ): #gobject.idle_add( self.clear ) if not os.path.exists( self.logfile ): #gobject.idle_add( self.warn, "File not found: " + self.logfile ) #print "File not found: " + self.logfile ###print "Disconnecting from log viewer thread" return gen = tail.tail( open( self.logfile )) while not self.quit: if not self.freeze: line = gen.next() if line: match = True for filter in self.filters: if filter: if not re.search( filter, line ): match = False break if match: gobject.idle_add( self.update_gui, line )
def run(self): #gobject.idle_add( self.clear ) if not os.path.exists(self.logfile): #gobject.idle_add( self.warn, "File not found: " + self.logfile ) #print "File not found: " + self.logfile ###print "Disconnecting from log viewer thread" return gen = tail.tail(open(self.logfile)) while not self.quit: if not self.freeze: line = gen.next() if line: match = True for filter in self.filters: if filter: if not re.search(filter, line): match = False break if match: gobject.idle_add(self.update_gui, line)
out += """ !!! gcylc WARNING: REMOTE TASK OUTPUT IS NOT LIVE, OPEN THE VIEWER AGAIN TO UPDATE !!! """ gobject.idle_add(self.update_gui, out) if self.proc != None: # See comment below self.proc.poll() else: # Live feed (pythonic 'tail -f') for local job submission. # if not os.path.exists( self.logfile ): # #gobject.idle_add( self.warn, "File not found: " + self.logfile ) # print "File not found: " + self.logfile # #print "Disconnecting from tailer thread" # return try: gen = tail.tail(open(self.logfile)) except Exception, x: # e.g. file not found print >>sys.stderr, x return while not self.quit: if not self.freeze: line = gen.next() if line: gobject.idle_add(self.update_gui, line) if self.proc != None: # poll the subprocess; this reaps its exit code and thus # prevents the pid of the finished process staying in # the OS process table (a "defunct process") until the # parent process exits.
out += """ !!! gcylc WARNING: REMOTE TASK OUTPUT IS NOT LIVE, OPEN THE VIEWER AGAIN TO UPDATE !!! """ gobject.idle_add( self.update_gui, out ) if self.proc != None: # See comment below self.proc.poll() else: # Live feed (pythonic 'tail -f') for local job submission. #if not os.path.exists( self.logfile ): # #gobject.idle_add( self.warn, "File not found: " + self.logfile ) # print "File not found: " + self.logfile # #print "Disconnecting from tailer thread" # return try: gen = tail.tail( open( self.logfile )) except Exception as x: # e.g. file not found dialog = warning_dialog( type(x).__name__ + ": " + str(x) ) gobject.idle_add(dialog.warn) return while not self.quit: if not self.freeze: line = gen.next() if line: gobject.idle_add( self.update_gui, line ) if self.proc != None: # poll the subprocess; this reaps its exit code and thus # prevents the pid of the finished process staying in # the OS process table (a "defunct process") until the