def _tmpl_datasetlist(self): tmpl = "" for filename, dataset in self.rbldnsd.datasets.iteritems(): if not dataset.available: activetime = "unavailable" filename = make_escaped_string(filename, ConsoleConstants.COLOR_RED) elif dataset.reloading: filename = make_escaped_string(filename, ConsoleConstants.COLOR_YELLOW) activetime = "(reloading)" else: filename = make_escaped_string(filename, ConsoleConstants.COLOR_GREEN) humanreadableactivetime = secs2human(int(time.time() - dataset.activesince)) activetime = make_escaped_string(humanreadableactivetime, ConsoleConstants.COLOR_CYAN) reloadinfo = dataset.lastreloadinfo if reloadinfo == None: info = "" else: (loadtime, newcount, diff) = reloadinfo loadtime = "%.2fs" % loadtime if diff >= 0: diff = "+%s" % diff newcount = make_escaped_string(newcount, ConsoleConstants.COLOR_MAGENTA) info = "loadtime: %s , %s records(%s)" % (loadtime, newcount, diff) tmpl += "%s age: %s %s\n" % (filename, activetime, info) return tmpl
def _tmpl_datasetlist(self): tmpl = "" for filename, dataset in self.rbldnsd.datasets.iteritems(): if not dataset.available: activetime = "unavailable" filename = make_escaped_string(filename, ConsoleConstants.COLOR_RED) elif dataset.reloading: filename = make_escaped_string(filename, ConsoleConstants.COLOR_YELLOW) activetime = "(reloading)" else: filename = make_escaped_string(filename, ConsoleConstants.COLOR_GREEN) humanreadableactivetime = secs2human(int(time.time() - dataset.activesince)) activetime = make_escaped_string(humanreadableactivetime, ConsoleConstants.COLOR_CYAN) reloadinfo = dataset.lastreloadinfo if reloadinfo == None: info = '' else: (loadtime, newcount, diff) = reloadinfo loadtime = "%.2fs" % loadtime if diff >= 0: diff = "+%s" % diff newcount = make_escaped_string(newcount, ConsoleConstants.COLOR_MAGENTA) info = "loadtime: %s , %s records(%s)" % (loadtime, newcount, diff) tmpl += "%s age: %s %s\n" % (filename, activetime, info) return tmpl
def _tmpl_runninsince(self): return make_escaped_string(secs2human(int(time.time() - self.startup)), fg=ConsoleConstants.COLOR_CYAN)