11 def __init__(self, name):
16 def insert(self, pri, name, fun):
17 triple = (pri,name,fun)
18 pos = bisect.bisect(self.pipe, triple)
20 raise RuntimeError, "MoePipeline.insert cannot alter the past"
21 self.pipe.insert(pos, triple)
23 def dump(self, file=sys.stdout):
24 file.write(">>> Pipeline %s\n" % self.name)
25 for pri,name,fun in self.pipe:
26 file.write("%03d %s\n" % (pri,name))
30 while self.index < len(self.pipe):
31 (pri,name,fun) = self.pipe[self.index]
32 moe.log.verbose(">> Running %s:%s\n" % (self.name,name))
37 def add_hook(self, name):
38 modname = "moe.hooks." + name
39 moe.log.verbose(">> Loading hook %s\n" % name)
40 if not sys.modules.has_key(modname):
41 fp, path, desc = imp.find_module(name, ["moe/hooks"])
43 imp.load_module(modname, fp, path, desc)
46 sys.modules[modname].init(self)
48 def configure(self, names):
49 for name in names.split():