Skip to content

Commit 96ca122

Browse files
committed
Skipping the UNKNOWN MDs
1 parent 5a7ab47 commit 96ca122

File tree

1 file changed

+37
-23
lines changed

1 file changed

+37
-23
lines changed

ads/aqua/modeldeployment/deployment.py

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,17 @@ def list(self, **kwargs) -> List["AquaDeployment"]:
15661566

15671567
results = []
15681568
for model_deployment in model_deployments:
1569+
# skipping the AQUA model deployments that are created with UNKNOWN deployment type
1570+
if (
1571+
model_deployment.model_deployment_configuration_details.deployment_type
1572+
in [UNKNOWN_ENUM_VALUE]
1573+
):
1574+
logger.debug(
1575+
f"Skipping model deployment with UNKNOWN deployment type: "
1576+
f"{getattr(model_deployment, 'id', '<missing_id>')}"
1577+
)
1578+
continue
1579+
15691580
oci_aqua = (
15701581
(
15711582
Tags.AQUA_TAG in model_deployment.freeform_tags
@@ -1576,40 +1587,43 @@ def list(self, **kwargs) -> List["AquaDeployment"]:
15761587
)
15771588

15781589
if oci_aqua:
1579-
# skipping the AQUA model deployments that are created with UNKNOWN deployment type
1580-
if (
1581-
model_deployment.model_deployment_configuration_details.deployment_type
1582-
in [UNKNOWN_ENUM_VALUE]
1583-
):
1584-
continue
1585-
15861590
try:
15871591
results.append(
15881592
AquaDeployment.from_oci_model_deployment(
15891593
model_deployment, self.region
15901594
)
15911595
)
1596+
1597+
# log telemetry if MD is in active or failed state
1598+
deployment_id = model_deployment.id
1599+
state = model_deployment.lifecycle_state.upper()
1600+
if state in ["ACTIVE", "FAILED"]:
1601+
# tracks unique deployments that were listed in the user compartment
1602+
# we arbitrarily choose last 8 characters of OCID to identify MD in telemetry
1603+
self.telemetry.record_event_async(
1604+
category="aqua/deployment",
1605+
action="list",
1606+
detail=get_ocid_substring(deployment_id, key_len=8),
1607+
value=state,
1608+
)
15921609
except Exception as e:
15931610
logger.error(
1594-
f"There was an issue processing the list of model deployments . Error: {str(e)}",
1611+
f"Error processing model deployment (ID: {getattr(model_deployment, 'id', 'unknown')}, "
1612+
f"Region: {getattr(self, 'region', 'unknown')}). Exception: {type(e).__name__}: {e}",
15951613
exc_info=True,
15961614
)
1597-
raise AquaRuntimeError(
1598-
f"There was an issue processing the list of model deployments . Error: {str(e)}"
1599-
) from e
1600-
1601-
# log telemetry if MD is in active or failed state
1602-
deployment_id = model_deployment.id
1603-
state = model_deployment.lifecycle_state.upper()
1604-
if state in ["ACTIVE", "FAILED"]:
1605-
# tracks unique deployments that were listed in the user compartment
1606-
# we arbitrarily choose last 8 characters of OCID to identify MD in telemetry
1607-
self.telemetry.record_event_async(
1608-
category="aqua/deployment",
1609-
action="list",
1610-
detail=get_ocid_substring(deployment_id, key_len=8),
1611-
value=state,
1615+
logger.error(
1616+
(
1617+
f"Failed to process AQUA model deployment "
1618+
f"'{getattr(model_deployment, 'display_name', '<unknown>')}' "
1619+
f"(OCID: {getattr(model_deployment, 'id', '<missing>')}, Region: {self.region}).\n"
1620+
f"Reason: {type(e).__name__}: {e}"
1621+
),
1622+
exc_info=True,
16121623
)
1624+
# raise AquaRuntimeError(
1625+
# f"There was an issue processing the list of model deployments . Error: {str(e)}"
1626+
# ) from e
16131627

16141628
logger.info(
16151629
f"Fetched {len(results)} model deployments from compartment_id={compartment_id}."

0 commit comments

Comments
 (0)