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()
27 ## FIXME: Configuration overrides
29 ## FIXME: Initialize logging early on
32 def init_global(self):
33 main_cfg = moe.config.MoeConfig(name = os.path.join(self.cfgs['HOME'], "config"))
34 self.cfgs.push(main_cfg)
37 test = self.cfgs['TEST_DIR']
38 if os.path.isdir(test):
41 moe.util.mkdir_tree(test)
43 raise MoeEvalErr, "Cannot create %s: %s" % (test, e.strerror)
46 task = self.cfgs['TASK']
47 task_dir = self.cfgs['TASK_DIR']
48 if not os.path.isdir(task_dir):
49 raise MoeEvalErr, "No such task %s" % task
50 task_cfg = moe.config.MoeConfig(name = os.path.join(task_dir, "config"))
51 self.cfgs.push(task_cfg)
53 type = self.cfgs['TASK_TYPE']
54 if type == "batch" or type == "interactive":
55 self.main_pipe.insert(100, "compile", moe.batch.compile)
56 self.main_pipe.insert(200, "batch-tests", moe.batch.tests)
57 elif type == "opendata":
58 raise MoeEvalErr, "Opendata tasks not implemented yet"
60 raise MoeEvalErr, "Unknown task type " + type
63 self.main_pipe.configure(self.cfgs["HOOKS"])
65 self.main_pipe.run(self)