"Dumps pipeline `pipe` at level DDEBUG (only compiles the dump if main level low enough)."
if self.log.level <= 5:
self.log.ddebug('****** Pipeline %r dump: ******'%pipe.name)
- self.log.ddebug(pipe.pipe)
- self.log.ddebug(pipe.dump(prefix='* '))
+ self.log.ddebug('\n'.join(pipe.dump(prefix='* ')))
+ self.log.ddebug('**************************')
+
+ def debug_dump_status(self):
+ "Dumps status metadata at level DDEBUG (only compiles the dump if main level low enough)."
+ if self.log.level <= 5:
+ self.log.ddebug('****** Status dump: ******')
+ self.log.ddebug('\n'.join(self.status.dump(prefix='* ')))
self.log.ddebug('**************************')
def hook_init_dirs(e):
Debugging dump of the pipe.
Returns a list of lines.
"""
- l=["%s >>> Pipeline %s\n" % (prefix, self.name)]
+ l=["%s >>> Pipeline %s" % (prefix, self.name)]
for pri, name, fun in self.pipe:
- l.append("%s% 3d %s, %s\n" % (prefix, pri, name, fun))
+ l.append("%s% 3d %s, %s" % (prefix, pri, name, fun))
+ return l
def run(self, *args, **kwargs):
self.index = 0
while self.index < len(self.pipe):
(pri,name,fun) = self.pipe[self.index]
if pri >= min_pri:
- self.e.log.debug("Pipeline %r:%d running: %s\n" % (self.name, pri, name))
+ self.e.log.debug("Pipeline %r:%d running: %s" % (self.name, pri, name))
try:
fun(*args, **kwargs)
except MoeAbortPipeline, err:
min_pri = self.skip_to
else:
- self.e.log.debug("Pipeline %r:d skipping: %s\n" % (self.name, pri, name))
+ self.e.log.debug("Pipeline %r:d skipping: %s" % (self.name, pri, name))
self.index += 1
self.index = -1
- self.e.log.debug("Pipeline %r finished\n" % (self.name))
+ self.e.log.debug("Pipeline %r finished" % (self.name))
m[k] = [m[k]]
return m[k]
- def str_lines(self, indent=""):
- "Return a list of lines, `indent` is indent prefix."
+ def dump(self, prefix=""):
+ "Return a list of lines, `prefix` is indent prefix."
l = []
for k,v in self.stat.items():
if type(v) == types.ListType: vals = v
else: vals = [v]
for w in vals:
if isinstance(w, MoeStatus):
- l.append("\t" * indent + k + "(\n")
- l.extend(self.str_lines(indent+" "))
- l.append("\t" * indent + ")\n")
+ l.append(prefix + k + "(\n")
+ l.extend(self.str_lines(prefix+" "))
+ l.append(prefix + ")\n")
else:
- l.append("\t" * indent + k + ":" + str(w) + "\n")
+ l.append(prefix + k + ":" + str(w) + "\n")
return l
def write(self, file=None, name=None):