Skip to content

Commit

Permalink
Add tags, provisioning_state and creation_context to batch-deployment…
Browse files Browse the repository at this point in the history
… list output (#29721)

Co-authored-by: Nancy Mejia Juarez <[email protected]>
  • Loading branch information
nancy-mejia and Nancy Mejia Juarez authored Apr 3, 2023
1 parent 19eccf1 commit 8c171cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from azure.ai.ml._schema._deployment.batch.job_definition_schema import JobDefinitionSchema
from azure.ai.ml._schema._deployment.deployment import DeploymentSchema
from azure.ai.ml._schema.core.fields import ComputeField, ExperimentalField, NestedField, StringTransformedEnum
from azure.ai.ml._schema.job.creation_context import CreationContextSchema
from azure.ai.ml._schema.job_resource_configuration import JobResourceConfigurationSchema
from azure.ai.ml.constants._common import BASE_PATH_CONTEXT_KEY
from azure.ai.ml.constants._deployment import BatchDeploymentOutputAction, BatchDeploymentType
Expand Down Expand Up @@ -56,6 +57,8 @@ class BatchDeploymentSchema(DeploymentSchema):
type = StringTransformedEnum(allowed_values=[BatchDeploymentType.COMPONENT, BatchDeploymentType.MODEL])

job_definition = ExperimentalField(NestedField(JobDefinitionSchema))
creation_context = NestedField(CreationContextSchema, dump_only=True)
provisioning_state = fields.Str(dump_only=True)

@post_load
def make(self, data: Any, **kwargs: Any) -> Any:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from azure.ai.ml.entities._deployment.deployment_settings import BatchRetrySettings
from azure.ai.ml.entities._job.resource_configuration import ResourceConfiguration
from azure.ai.ml.entities._util import load_from_dict
from azure.ai.ml.entities._system_data import SystemData
from azure.ai.ml.exceptions import ErrorCategory, ErrorTarget, ValidationErrorType, ValidationException

from ..._vendor.azure_resources.flatten_json import flatten, unflatten
Expand Down Expand Up @@ -117,6 +118,7 @@ def __init__(

self.deployment_type = kwargs.pop("type", "Model")
self.job_definition = kwargs.pop("job_definition", None)
self._provisioning_state = kwargs.pop("provisioning_state", None)

super(BatchDeployment, self).__init__(
name=name,
Expand Down Expand Up @@ -160,6 +162,15 @@ def __init__(
def instance_count(self) -> int:
return self.resources.instance_count if self.resources else None

@property
def provisioning_state(self) -> Optional[str]:
"""Batch deployment provisioning state, readonly.
:return: Batch deployment provisioning state.
:rtype: Optional[str]
"""
return self._provisioning_state

@instance_count.setter
def instance_count(self, value: int) -> None:
if not self.resources:
Expand Down Expand Up @@ -264,6 +275,8 @@ def _from_rest_object(cls, deployment: BatchDeploymentData): # pylint: disable=
max_concurrency_per_instance=deployment.properties.max_concurrency_per_instance,
endpoint_name=_parse_endpoint_name_from_deployment_id(deployment.id),
properties=deployment.properties.properties,
creation_context=SystemData._from_rest_object(deployment.system_data),
provisioning_state=deployment.properties.provisioning_state,
)

# Job definition is in private preview. If private preview environment is
Expand Down

0 comments on commit 8c171cd

Please sign in to comment.