12 class MoeEvalErr(Exception):
18 self.cfgs = moe.config.MoeConfigStack()
19 self.builtins = moe.config.MoeConfig()
20 self.cfgs.push(self.builtins)
21 self.main_pipe = moe.pipeline.MoePipeline("main")
22 self.meta = moe.meta.MoeMeta()
25 def init(self, overrides=None):
26 self.init_global(overrides)
28 ## FIXME: Initialize logging early on
31 def init_global(self, overrides):
32 main_cfg = moe.config.MoeConfig(name = os.path.join(self.cfgs['HOME'], "config"))
33 self.cfgs.push(main_cfg)
35 self.cfgs.push(overrides)
38 test = self.cfgs['TEST_DIR']
39 if os.path.isdir(test):
42 moe.util.mkdir_tree(test)
44 raise MoeEvalErr, "Cannot create %s: %s" % (test, e.strerror)
47 task = self.cfgs['TASK']
48 task_dir = self.cfgs['TASK_DIR']
49 if not os.path.isdir(task_dir):
50 raise MoeEvalErr, "No such task %s" % task
51 task_cfg = moe.config.MoeConfig(name = os.path.join(task_dir, "config"))
52 self.cfgs.push(task_cfg)
53 self.meta["task"] = task
55 type = self.cfgs['TASK_TYPE']
56 if type == "batch" or type == "interactive":
57 moe.batch.prepare_pipe(self)
58 elif type == "opendata":
59 raise MoeEvalErr, "Opendata tasks not implemented yet"
61 raise MoeEvalErr, "Unknown task type " + type
64 self.main_pipe.configure(self.cfgs["HOOKS"])
66 self.main_pipe.run(self)