Exemplo n.º 1
0
def generate_clipper_deployment_snapshot_path(service_name, service_version):
    return os.path.join(
        _get_bentoml_home(),
        "internal",
        "clipper-deployment-snapshots",
        service_name,
        service_version,
        datetime.now().isoformat(),
    )
Exemplo n.º 2
0
import logging
import subprocess
import json
from subprocess import PIPE
from packaging import version


from bentoml.configuration import _get_bentoml_home
from bentoml.utils.whichcraft import which
from bentoml.exceptions import BentoMLException, BentoMLMissingDepdencyException

logger = logging.getLogger(__name__)


SERVERLESS_VERSION = '1.53.0'
BENTOML_HOME = _get_bentoml_home()

# We will install serverless package and use the installed one, instead
# of user's installation
SERVERLESS_BIN_COMMAND = '{}/node_modules/.bin/serverless'.format(BENTOML_HOME)


def check_nodejs_comptaible_version():
    if which('npm') is None:
        raise BentoMLMissingDepdencyException(
            'NPM is not installed. Please visit www.nodejs.org for instructions'
        )
    if which("node") is None:
        raise BentoMLMissingDepdencyException(
            "NodeJs is not installed, please visit www.nodejs.org for install "
            "instructions."