def __init__(self, *args, **kwargs): ShareParameter.batch_name = self.__class__.__name__ logging.config.dictConfig( YamlUtil.load_file(PathUtil.logging_conf_path())) logger = logging.getLogger('jetline') logger.info('start') super(BaseTestCase, self).__init__(*args, **kwargs)
from jetline.util.path_util import PathUtil from jetline.util.yaml_util import YamlUtil from jetline.share_parameter.share_parameter import ShareParameter if __name__ == '__main__': exit_code = ShareParameter.error_return_code module = None logger = None try: exec_yaml_path, exec_date, working_dir = Module.parse_kick_args(sys.argv[1:]) if working_dir is not None: os.chdir(working_dir) batch_name, ext = os.path.splitext(os.path.basename(exec_yaml_path)) ShareParameter.batch_name = batch_name logging.config.dictConfig(YamlUtil.load_file(PathUtil.logging_conf_path())) logger = logging.getLogger('jetline') logger.info('module kicked...') logger.info('exec yaml: ' + exec_yaml_path) logger.info('exec_date: ' + exec_date) module = Module(exec_yaml_path, exec_date) module.set_up() module.execute() exit_code = ShareParameter.success_return_code except Exception as e: logger.exception(e) exit_code = ShareParameter.error_return_code finally: if module is not None: module.tear_down() if logger is not None:
def test_logger_yaml_path(self): logging_conf_path = PathUtil.logging_conf_path() self.assertTrue(os.path.exists(logging_conf_path))