]> mj.ucw.cz Git - moe.git/blobdiff - t/moe/eval.py
Update makefile
[moe.git] / t / moe / eval.py
index 3ee55666c5d671406be50add5f08f7bc4f94d958..1e54b4ee270e387cfd7bb53090f282a43fbaaaf7 100644 (file)
@@ -25,18 +25,8 @@ class Eval:
     def __getitem__(self, key):
        return self.config[key]
 
     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=[]):
     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
        self.log.info("Initializing ...")
        
        # set basic builtins
@@ -53,10 +43,9 @@ class Eval:
        
        # load config file
        self.config.fix('CONFIG')
        
        # load config file
        self.config.fix('CONFIG')
-       with open(self['CONFIG'], 'r') as f:
-         self.config.parse(f, source=self['CONFIG'], level=30)
+       self.config.parse_file(self['CONFIG'], level=30)
        # fix variables
        # 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'])
        # 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 +57,18 @@ class Eval:
        
        # insert hooks into main pipeline
        # TODO
        
        # insert hooks into main pipeline
        # TODO
+       # TODO moe.box.init(self)
 
        # insert custom hooks
        self.conf.fix('HOOKS')
        self.main_pipe.configure(self['HOOKS'])
 
 
        # 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.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']
 
     def init_TDIR(self):
        test = self['TDIR']
@@ -90,6 +79,19 @@ class Eval:
        except OSError, err:
            raise moe.MoeError, "Cannot create %s: %s" % (test, err.strerror)
 
        except OSError, err:
            raise moe.MoeError, "Cannot create %s: %s" % (test, err.strerror)
 
+    def debug_dump_config(self):
+      "Dumps config at level DDEBUG (only compiles the dump if main level is 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 pipeline `pipe` at level DDEBUG (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):
 
 #TODO ...
     def init_task(self):