]> mj.ucw.cz Git - moe.git/blobdiff - t/moe/eval.py
Updated documentation and tidyed up eval.py
[moe.git] / t / moe / eval.py
index 3ee55666c5d671406be50add5f08f7bc4f94d958..c92ce8a753c06d2bb0c2b9885ddefc0370f3a444 100644 (file)
@@ -25,18 +25,8 @@ class Eval:
     def __getitem__(self, key):
        return self.config[key]
 
-    def debug_dumpconf(self):
-       if self.log.level <= 5:
-         self.log.ddebug('****** Config dump: ******'))
-         self.log.ddebug(self.config.dump('**** '))
-         self.log.ddebug('**************************'))
-    def debug_dumppipe(self, pipe):
-       if self.log.level <= 5:
-         self.log.ddebug('****** Pipeline %r dump: ******'%pipe,name))
-         self.log.ddebug(pipe.dump(prefix='**** '))
-         self.log.ddebug('**************************'))
-       
     def init(self, overrides=[]):
+       "Initializes most part of Eval before running the pipeline. See the timeline for details."
        self.log.info("Initializing ...")
        
        # set basic builtins
@@ -56,7 +46,7 @@ class Eval:
        with open(self['CONFIG'], 'r') as f:
          self.config.parse(f, source=self['CONFIG'], level=30)
        # fix variables
-       self.config.fix(['LOG', 'VERBOSE', 'HOME', 'DEBUG_LEVEL', 'TDIR'])
+       self.config.fix(['LOG', 'USER_LOG', 'VERBOSE', 'HOME', 'DEBUG_LEVEL', 'TDIR'])
        # start logging
        self.log.open_eval_log(self['LOG'], self['DEBUG_LEVEL'], redirect_fds = True)
        self.log.open_user_log(self['USER_LOG'])
@@ -68,18 +58,18 @@ class Eval:
        
        # insert hooks into main pipeline
        # TODO
+       # TODO moe.box.init(self)
 
        # insert custom hooks
        self.conf.fix('HOOKS')
        self.main_pipe.configure(self['HOOKS'])
 
-       # go! 
+    def run(self):
+       "Run the main pipeline."
        self.debug_dump_pipe(self.main_pipe)
        self.debug('Running main pipeline')
        self.main_pipe.run(self)
 
-       #self.init_task()
-       #moe.box.init(self)
 
     def init_TDIR(self):
        test = self['TDIR']
@@ -90,6 +80,19 @@ class Eval:
        except OSError, err:
            raise moe.MoeError, "Cannot create %s: %s" % (test, err.strerror)
 
+    def debug_dump_config(self):
+      "Dumps at level DDEBUG and only compiles the dump if main level low enough."
+      if self.log.level <= 5:
+       self.log.ddebug('****** Config dump: ******'))
+       self.log.ddebug(self.config.dump('**** '))
+       self.log.ddebug('**************************'))
+
+    def debug_dump_pipe(self, pipe):
+      "Dumps at level DDEBUG and 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.dump(prefix='**** '))
+       self.log.ddebug('**************************'))
 
 #TODO ...
     def init_task(self):