import sys
sys.path.append('.')
-import moe.meta
+import moe
+import moe.stat
import moe.config
import moe.eval
import moe.pipeline
-
-#m = moe.meta.MoeMeta()
-#m['a'] = '1'
-#m.write()
-
-c = moe.config.MoeConfig(name='/dev/stdin')
-c.dump()
-
-#d = moe.config.MoeConfig(name='/dev/stdin')
-#d.dump()
-
-s = moe.config.MoeConfigStack()
-s.push(c)
-#s.push(d)
-
-s.dump_defs()
-
-#s.apply_overrides("x_")
-#s.dump_defs()
-
-print "***"
-s.dump()
-
-p = moe.pipeline.MoePipeline('test')
-p.insert(10, 'brum', lambda x: p.insert(30, 'xyzzy', lambda y:y))
-p.insert(20, 'brummm', lambda x: x)
-p.configure("y")
-p.dump()
-p.run(5)
+import moe.batch
+
+e = moe.eval.Eval()
+
+try:
+ overrides = moe.config.parse_overrides(sys.argv)
+ e.builtins.set("HOME", ".")
+ e.builtins.set("TASK", "sum")
+ e.builtins.set("CONTESTANT", "mj")
+ e.log.progress("### Evaluating task %s of contestant %s ###\n\n" % (e.cfgs['TASK'], e.cfgs['CONTESTANT']))
+ e.init(overrides)
+except moe.MoeErr, err:
+ e.log.shout("FATAL: %s\n" % err)
+ sys.exit(1)
+
+try:
+ if len(sys.argv) > 1:
+ file = sys.argv[1]
+ else:
+ file = None
+ moe.batch.locate(e, file)
+ e.run()
+except moe.MoeErr, err:
+ e.log.shout("FATAL: %s\n" % err)
+ sys.exit(1)
+except moe.SolutionErr, err:
+ ## FIXME: In this case, we might write the status file
+ e.log.shout("%s\n" % err)
+ sys.exit(1)
+
+print "\nFinal status file:"
+e.stat.write()