X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=t%2Fmoe%2Feval.py;h=1e54b4ee270e387cfd7bb53090f282a43fbaaaf7;hb=204f84eafd2659dd82b06feb7d182d4a15a44237;hp=3ee55666c5d671406be50add5f08f7bc4f94d958;hpb=c5561169bd9291368179825d380a55e4dbc2a339;p=moe.git diff --git a/t/moe/eval.py b/t/moe/eval.py index 3ee5566..1e54b4e 100644 --- a/t/moe/eval.py +++ b/t/moe/eval.py @@ -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 @@ -53,10 +43,9 @@ class Eval: # 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 - 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 +57,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 +79,19 @@ class Eval: 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):