How to use the bentoml.bundler.loader._resolve_remote_bundle_path function in bentoml

To help you get started, we’ve selected a few bentoml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bentoml / BentoML / bentoml / deployment / aws_lambda / __init__.py View on Github external
def _add(self, deployment_pb, bento_pb, bento_path):
        if loader._is_remote_path(bento_path):
            with loader._resolve_remote_bundle_path(bento_path) as local_path:
                return self._add(deployment_pb, bento_pb, local_path)

        deployment_spec = deployment_pb.spec
        lambda_deployment_config = deployment_spec.aws_lambda_operator_config
        bento_service_metadata = bento_pb.bento.bento_service_metadata
        lambda_s3_bucket = generate_aws_compatible_string(
            'btml-{namespace}-{name}-{random_string}'.format(
                namespace=deployment_pb.namespace,
                name=deployment_pb.name,
                random_string=uuid.uuid4().hex[:6].lower(),
            )
        )

        try:
            py_major, py_minor, _ = bento_service_metadata.env.python_version.split('.')
            if py_major != '3':
github bentoml / BentoML / bentoml / deployment / serverless / aws_lambda.py View on Github external
def _apply(self, deployment_pb, bento_pb, yatai_service, bento_path):
        if loader._is_remote_path(bento_path):
            with loader._resolve_remote_bundle_path(bento_path) as local_path:
                return self._apply(deployment_pb, bento_pb, yatai_service, local_path)

        deployment_spec = deployment_pb.spec
        aws_config = deployment_spec.aws_lambda_operator_config

        bento_service_metadata = bento_pb.bento.bento_service_metadata

        template = 'aws-python3'
        if version.parse(bento_service_metadata.env.python_version) < version.parse(
            '3.0.0'
        ):
            template = 'aws-python'

        api_names = (
            [aws_config.api_name]
            if aws_config.api_name
github bentoml / BentoML / bentoml / deployment / sagemaker / __init__.py View on Github external
def _add(self, deployment_pb, bento_pb, bento_path):
        if loader._is_remote_path(bento_path):
            with loader._resolve_remote_bundle_path(bento_path) as local_path:
                return self._add(deployment_pb, bento_pb, local_path)

        deployment_spec = deployment_pb.spec
        sagemaker_config = deployment_spec.sagemaker_operator_config

        raise_if_api_names_not_found_in_bento_service_metadata(
            bento_pb.bento.bento_service_metadata, [sagemaker_config.api_name]
        )

        sagemaker_client = boto3.client('sagemaker', sagemaker_config.region)

        with TempDirectory() as temp_dir:
            sagemaker_project_dir = os.path.join(temp_dir, deployment_spec.bento_name)
            _init_sagemaker_project(sagemaker_project_dir, bento_path)
            ecr_image_path = create_and_push_docker_image_to_ecr(
                sagemaker_config.region,