提交 c0ac3bf4 编写于 作者: C chengmo

fix ci error code

上级 e55a86c8
...@@ -191,17 +191,10 @@ class Trainer(object): ...@@ -191,17 +191,10 @@ class Trainer(object):
None : run a processor for this status None : run a processor for this status
""" """
status = context['status'] status = context['status']
try: if status in self._status_processor:
if status in self._status_processor: self._status_processor[context['status']](context)
self._status_processor[context['status']](context) else:
else: self.other_status_processor(context)
self.other_status_processor(context)
except Exception as err:
traceback.print_exc()
print('Catch Exception:%s' % str(err))
sys.stdout.flush()
self._context['is_exit'] = self.handle_processor_exception(
status, context, err)
def other_status_processor(self, context): def other_status_processor(self, context):
""" """
...@@ -218,7 +211,7 @@ class Trainer(object): ...@@ -218,7 +211,7 @@ class Trainer(object):
Return: Return:
bool exit_app or not bool exit_app or not
""" """
print('Exit app. catch exception in precoss status:%s, except:%s' % print('Exit app. catch exception in precoss status: [%s], except: %s' %
(context['status'], str(exception))) (context['status'], str(exception)))
return True return True
...@@ -233,10 +226,17 @@ class Trainer(object): ...@@ -233,10 +226,17 @@ class Trainer(object):
keep running by statu context. keep running by statu context.
""" """
while True: while True:
self.reload_train_context() try:
self.context_process(self._context) self.reload_train_context()
if self._context['is_exit']: self.context_process(self._context)
break if self._context['is_exit']:
break
except Exception as err:
traceback.print_exc()
print('Catch Exception:%s' % str(err))
sys.stdout.flush()
self.handle_processor_exception(status, context, err)
sys.exit(type(err).__name__)
def user_define_engine(engine_yaml): def user_define_engine(engine_yaml):
......
...@@ -449,8 +449,4 @@ if __name__ == "__main__": ...@@ -449,8 +449,4 @@ if __name__ == "__main__":
engine_registry() engine_registry()
which_engine = get_engine(args) which_engine = get_engine(args)
engine = which_engine(args) engine = which_engine(args)
try: engine.run()
engine.run()
sys.exit(0)
except:
sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册