@@ -66,7 +66,7 @@ def prepare_container_def(self, instance_type):
6666 """
6767 return sagemaker.container_def(self.image, self.model_data, self.env)
6868
69- def deploy(self, initial_instance_count, instance_type, endpoint_name=None):
69+ def deploy(self, initial_instance_count, instance_type, endpoint_name=None, tags=None ):
7070 """Deploy this ``Model`` to an ``Endpoint`` and optionally return a ``Predictor``.
7171
7272 Create a SageMaker ``Model`` and ``EndpointConfig``, and deploy an ``Endpoint`` from this ``Model``.
@@ -82,6 +82,7 @@ def deploy(self, initial_instance_count, instance_type, endpoint_name=None):
8282 ``Endpoint`` created from this ``Model``.
8383 endpoint_name (str): The name of the endpoint to create (default: None).
8484 If not specified, a unique endpoint name will be created.
85+ tags (list[dict[str, str]]): A list of key-value pairs for tagging the endpoint (default: None).
8586
8687 Returns:
8788 callable[string, sagemaker.session.Session] or None: Invocation of ``self.predictor_cls`` on
@@ -98,7 +99,7 @@ def deploy(self, initial_instance_count, instance_type, endpoint_name=None):
9899 self.sagemaker_session.create_model(model_name, self.role, container_def)
99100 production_variant = sagemaker.production_variant(model_name, instance_type, initial_instance_count)
100101 self.endpoint_name = endpoint_name or model_name
101- self.sagemaker_session.endpoint_from_production_variants(self.endpoint_name, [production_variant])
102+ self.sagemaker_session.endpoint_from_production_variants(self.endpoint_name, [production_variant], tags )
102103 if self.predictor_cls:
103104 return self.predictor_cls(self.endpoint_name, self.sagemaker_session)
104105
0 commit comments