def status(self): """Returns status of a component""" if self.is_alive: return Status.RUNNING if self.configuration.silent or osutil.is_empty(self.stderr) else Status.DISTURBED elif not self.started or self.stopped: return Status.STOPPED else: return Status.TERMINATED
def status(self): """Returns status of a component""" st = super(QComponent, self).status if (st == Status.TERMINATED or st == Status.DISTURBED) and not osutil.is_empty(self.stderr): stderr = open(self.stderr, "r") err = osutil.open_mmap(stderr.fileno()) if err[-8:].strip()[-6:] == "wsfull" : return Status.WSFULL if err[-10:].strip()[-8:] == "-w abort" : return Status.WSFULL return st
def status(self): """Returns status of a component""" if self.is_alive: return Status.RUNNING if self.configuration.silent or osutil.is_empty( self.stderr) else Status.DISTURBED elif not self.started or self.stopped: return Status.STOPPED else: return Status.TERMINATED
def status(self): st = super(QBatch, self).status if (st == Status.TERMINATED or st == Status.DISTURBED) and not osutil.is_empty(self.stderr): stderr = open(self.stderr, "r") err = osutil.open_mmap(stderr.fileno()) if err[-8:].strip()[-6:] == "wsfull" : return Status.WSFULL if err[-10:].strip()[-8:] == "-w abort" : return Status.WSFULL if (st == Status.TERMINATED): return Status.STOPPED return st
def status(self): """Returns status of a component""" st = super(QComponent, self).status try: if (st == Status.TERMINATED or st == Status.DISTURBED) and not osutil.is_empty(self.stderr): stderr_size = osutil.file_size(self.stderr) if stderr_size >= 8: with open(self.stderr, "r") as stderr: stderr.seek(stderr_size - 10 if stderr_size > 10 else stderr_size - 8) err = stderr.read() if err[-8:].strip()[-6:] == "wsfull" : st = Status.WSFULL if err[-10:].strip()[-8:] == "-w abort" : st = Status.WSFULL finally: return st
def status(self): """Returns status of a component""" st = super(QComponent, self).status try: if (st == Status.TERMINATED or st == Status.DISTURBED) and not osutil.is_empty(self.stderr): stderr_size = osutil.file_size(self.stderr) if stderr_size > 5: with open(self.stderr, "r") as stderr: if (stderr_size > 9): stderr.seek(stderr_size - 9) err = stderr.read() if "wsfull" in err or "-w abort" in err: st = Status.WSFULL finally: return st
def _find_rolled_log(self, path): LOOKUP_LENGTH = 512 while path and os.path.exists(path) and not osutil.is_empty(path): with open(path, "r") as stdout: file_size = osutil.file_size(path) lookup_pos = file_size - LOOKUP_LENGTH if file_size > LOOKUP_LENGTH else 0 stdout.seek(lookup_pos) log = stdout.read() match = None for match in QComponent.rolled_log_pattern.finditer(log): pass if match: path = os.path.normpath(match.group("path").strip()) continue break return path
def show_file(path, internal=False): if not path or is_empty(path): return False try: if internal or VIEWER is None: print "\n[BEGIN]" with open(path, "r") as file: for line in file: print line.rstrip() print "[END]\n" else: p = subprocess.Popen([VIEWER, path]) p.communicate() return True except: return get_short_exc_info()
def status(self): """Returns status of a component""" st = super(QComponent, self).status try: if (st == Status.TERMINATED or st == Status.DISTURBED) and not osutil.is_empty(self.stderr): stderr_size = osutil.file_size(self.stderr) if stderr_size >= 8: with open(self.stderr, "r") as stderr: stderr.seek(stderr_size - 10 if stderr_size > 10 else stderr_size - 8) err = stderr.read() if err[-8:].strip()[-6:] == "wsfull": st = Status.WSFULL if err[-10:].strip()[-8:] == "-w abort": st = Status.WSFULL finally: return st