Exemplo n.º 1
0
 def __init__(
     self,
     archive_path,
     api_name,
     region=None,
     instance_count=None,
     instance_type=None,
 ):
     if which("docker") is None:
         raise ValueError(
             "docker is not installed, please install docker and then try again"
         )
     super(SagemakerDeployment, self).__init__(archive_path)
     self.region = DEFAULT_REGION if region is None else region
     self.instance_count = (
         DEFAULT_INSTANCE_COUNT if instance_count is None else instance_count
     )
     self.instant_type = (
         DEFAULT_INSTANCE_TYPE if instance_type is None else instance_type
     )
     self.api = self.bento_service.get_service_api(api_name)
     self.sagemaker_client = boto3.client("sagemaker", region_name=self.region)
     self.model_name = generate_aws_compatible_string(
         "bentoml-" + self.bento_service.name + "-" + self.bento_service.version
     )
     self.endpoint_config_name = generate_aws_compatible_string(
         self.bento_service.name
         + "-"
         + self.bento_service.version
         + "-configuration"
     )
Exemplo n.º 2
0
 def __init__(
     self,
     archive_path,
     api_name,
     region=None,
     instance_count=None,
     instance_type=None,
 ):
     if which("docker") is None:
         raise ValueError(
             "docker is not installed, please install docker and then try again"
         )
     super(SagemakerDeployment, self).__init__(archive_path)
     self.region = DEFAULT_REGION if region is None else region
     self.instance_count = (DEFAULT_INSTANCE_COUNT
                            if instance_count is None else instance_count)
     self.instant_type = (DEFAULT_INSTANCE_TYPE
                          if instance_type is None else instance_type)
     apis = self.bento_service.get_service_apis()
     if api_name:
         self.api = next(item for item in apis if item.name == api_name)
     elif len(apis) == 1:
         self.api = apis[0]
     else:
         raise BentoMLException(
             "Please specify api-name, when more than one API is present in the "
             "archive")
     self.sagemaker_client = boto3.client("sagemaker",
                                          region_name=self.region)
     self.model_name = generate_aws_compatible_string(
         "bentoml-" + self.bento_service.name + "-" +
         self.bento_service.version)
     self.endpoint_config_name = generate_aws_compatible_string(
         self.bento_service.name + "-" + self.bento_service.version +
         "-configuration")
Exemplo n.º 3
0
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."
        )
    version_result = subprocess.check_output(["node", "-v"]).decode("utf-8").strip()
    parsed_version = version.parse(version_result)

    if not parsed_version >= version.parse('v8.10.0'):
        raise ValueError(
            "Incompatible Nodejs version, please install version v8.10.0 " "or greater"
        )
Exemplo n.º 4
0
def check_nodejs_compatible_version():
    # We moved import which to inside this function, because it is easier to test with
    # with mock
    from bentoml.utils.whichcraft import which

    if which('npm') is None:
        raise BentoMLMissingDependencyException(
            'NPM is not installed. Please visit www.nodejs.org for instructions'
        )
    if which("node") is None:
        raise BentoMLMissingDependencyException(
            "NodeJs is not installed, please visit www.nodejs.org for install "
            "instructions.")
    version_result = subprocess.check_output(["node",
                                              "-v"]).decode("utf-8").strip()
    parsed_version = version.parse(version_result)

    if not parsed_version >= version.parse('v8.10.0'):
        raise ValueError(
            "Incompatible Nodejs version, please install version v8.10.0 "
            "or greater")
Exemplo n.º 5
0
def check_serverless_compatiable_version():
    if which('serverless') is None:
        raise ValueError(
            'Serverless framework is not installed, please visit ' +
            'www.serverless.com for install instructions.')

    version_result = subprocess.check_output(['serverless', '-v'])
    parsed_version = version.parse(version_result.decode('utf-8').strip())

    if parsed_version >= version.parse('1.40.0'):
        return
    else:
        raise ValueError(
            'Incompatiable serverless version, please install version 1.40.0 or greater'
        )
Exemplo n.º 6
0
def check_serverless_compatiable_version():
    if which("serverless") is None:
        raise ValueError(
            "Serverless framework is not installed, please visit " +
            "www.serverless.com for install instructions.")

    version_result = subprocess.check_output(["serverless", "-v"])
    parsed_version = version.parse(version_result.decode("utf-8").strip())

    if parsed_version >= version.parse("1.40.0"):
        return
    else:
        raise ValueError(
            "Incompatiable serverless version, please install version 1.40.0 or greater"
        )
Exemplo n.º 7
0
def check_serverless_compatiable_version():
    if which("serverless") is None:
        raise ValueError(
            "Serverless framework is not installed, please visit " +
            "www.serverless.com for install instructions.")

    version_result = (subprocess.check_output(["serverless",
                                               "-v"]).decode("utf-8").strip())
    if "(Enterprise Plugin:" in version_result:
        slice_end_index = version_result.find(" (Enterprise")
        version_result = version_result[0:slice_end_index]
    parsed_version = version.parse(version_result)

    if parsed_version >= version.parse(MINIMUM_SERVERLESS_VERSION):
        return
    else:
        raise ValueError(
            "Incompatiable serverless version, please install version 1.40.0 or greater"
        )