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
# 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'])
# 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']
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):