def load(cls, filepath): conf = cls() with open(filepath, "rb") as config_file: yml_content = config_file.read() conf.config = conf._yaml.load(yml_content) ver = str(conf["version"]) py_ver = conf.config["env"]["python_version"] if ver != BENTOML_VERSION: msg = ( "Saved BentoService bundle version mismatch: loading BentoService " "bundle create with BentoML version {}, but loading from BentoML " "version {}".format(conf["version"], BENTOML_VERSION)) # If major version is different, then there could be incompatible API # changes. Raise error in this case. if ver.split(".")[0] != BENTOML_VERSION.split(".")[0]: if not BENTOML_VERSION.startswith('0+untagged'): raise BentoMLConfigException(msg) else: logger.warning(msg) else: # Otherwise just show a warning. logger.warning(msg) if py_ver != PYTHON_VERSION: logger.warning( f"Saved BentoService Python version mismatch: loading " f"BentoService bundle created with Python version {py_ver}, " f"but current environment version is {PYTHON_VERSION}.") return conf
def load(cls, filepath): conf = cls() with open(filepath, "rb") as config_file: yml_content = config_file.read() conf.config = conf._yaml.load(yml_content) if conf["version"] != BENTOML_VERSION: msg = ( "BentoArchive version mismatch: loading archive bundled in version " "{}, but loading from version {}".format( conf["version"], BENTOML_VERSION ) ) # If major version is different, then there could be incompatible API # changes. Raise error in this case. if conf["version"].split(".")[0] != BENTOML_VERSION.split(".")[0]: if not BENTOML_VERSION.startswith('0+untagged'): raise ValueError(msg) else: LOG.warning(msg) else: # Otherwise just show a warning. LOG.warning(msg) return conf
def load(cls, filepath): conf = cls() with open(filepath, "rb") as config_file: yml_content = config_file.read() conf.config = conf._yaml.load(yml_content) if conf["version"] != BENTOML_VERSION: msg = ( "Saved BentoService bundle version mismatch: loading BentoServie " "bundle create with BentoML version {}, but loading from BentoML " "version {}".format(conf["version"], BENTOML_VERSION)) # If major version is different, then there could be incompatible API # changes. Raise error in this case. if conf["version"].split(".")[0] != BENTOML_VERSION.split(".")[0]: if not BENTOML_VERSION.startswith('0+untagged'): raise BentoMLConfigException(msg) else: logger.warning(msg) else: # Otherwise just show a warning. logger.warning(msg) return conf
def _is_pip_installed_bentoml(): is_installed_package = hasattr(version_mod, 'version_json') is_tagged = not __version__.startswith('0+untagged') is_clean = not version_mod.get_versions()['dirty'] return is_installed_package and is_tagged and is_clean
def is_pypi_release(): is_installed_package = hasattr(version_mod, 'version_json') is_tagged = not BENTOML_VERSION.startswith('0+untagged') is_clean = not version_mod.get_versions()['dirty'] return is_installed_package and is_tagged and is_clean