Skip to content

Commit 3d28514

Browse files
resolve merge conflicts
2 parents faaf7f5 + e11b117 commit 3d28514

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2517
-192
lines changed

.github/workflows/run-unittests-default_setup.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
workflow_dispatch:
55
pull_request:
66
branches: [ "main" ]
7+
paths:
8+
- "ads/**"
9+
- "!ads/opctl/operator/**"
10+
- "!ads/feature_store/**"
11+
- "pyproject.toml"
12+
713

814
# Cancel in progress workflows on pull_requests.
915
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value

.github/workflows/run-unittests-py38-cov-report.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
workflow_dispatch:
55
pull_request:
66
branches: [ "main" ]
7+
paths:
8+
- "ads/**"
9+
- "!ads/opctl/operator/**"
10+
- "!ads/feature_store/**"
11+
- "pyproject.toml"
712

813
# Cancel in progress workflows on pull_requests.
914
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value

.github/workflows/run-unittests-py39-py310.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: "[Py3.9][Py3.10] - tests/unitary/**"
33
on:
44
workflow_dispatch:
55
pull_request:
6+
branches: [ "main" ]
7+
paths:
8+
- "ads/**"
9+
- "!ads/opctl/operator/**"
10+
- "!ads/feature_store/**"
11+
- "pyproject.toml"
612

713
# Cancel in progress workflows on pull_requests.
814
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value

ads/aqua/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import os
1010
from ads.aqua.utils import fetch_service_compartment
11-
from ads.config import OCI_RESOURCE_PRINCIPAL_VERSION
11+
from ads.config import NB_SESSION_OCID, OCI_RESOURCE_PRINCIPAL_VERSION
1212
from ads import set_auth
1313

1414
logger = logging.getLogger(__name__)
@@ -22,7 +22,15 @@
2222
if not ODSC_MODEL_COMPARTMENT_OCID:
2323
try:
2424
ODSC_MODEL_COMPARTMENT_OCID = fetch_service_compartment()
25-
except Exception as e:
25+
except:
26+
pass
27+
28+
if not ODSC_MODEL_COMPARTMENT_OCID:
29+
logger.error(
30+
f"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua."
31+
)
32+
if NB_SESSION_OCID:
2633
logger.error(
27-
f"ODSC_MODEL_COMPARTMENT_OCID environment variable is not set for Aqua, due to {e}."
34+
f"Aqua is not available for this notebook session {NB_SESSION_OCID}."
2835
)
36+
exit()

ads/aqua/decorator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
RequestException,
1818
ServiceError,
1919
)
20+
from tornado.web import HTTPError
2021

2122
from ads.aqua.exception import AquaError
2223
from ads.aqua.extension.base_handler import AquaAPIhandler
@@ -58,6 +59,7 @@ def inner_function(self: AquaAPIhandler, *args, **kwargs):
5859
except ServiceError as error:
5960
self.write_error(
6061
status_code=error.status or 500,
62+
message=error.message,
6163
reason=error.message,
6264
service_payload=error.args[0] if error.args else None,
6365
exc_info=sys.exc_info(),
@@ -91,6 +93,12 @@ def inner_function(self: AquaAPIhandler, *args, **kwargs):
9193
service_payload=error.service_payload,
9294
exc_info=sys.exc_info(),
9395
)
96+
except HTTPError as e:
97+
self.write_error(
98+
status_code=e.status_code,
99+
reason=e.log_message,
100+
exc_info=sys.exc_info(),
101+
)
94102
except Exception as ex:
95103
self.write_error(
96104
status_code=500,

ads/aqua/deployment.py

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -391,30 +391,25 @@ def create(
391391
.with_runtime(container_runtime)
392392
).deploy(wait_for_completion=False)
393393

394-
if is_fine_tuned_model:
395-
# tracks unique deployments that were created in the user compartment
396-
self.telemetry.record_event_async(
397-
category="aqua/custom/deployment", action="create", detail=model_name
398-
)
399-
# tracks the shape used for deploying the custom models by name
400-
self.telemetry.record_event_async(
401-
category=f"aqua/custom/deployment/create",
402-
action="shape",
403-
detail=instance_shape,
404-
value=model_name
405-
)
406-
else:
407-
# tracks unique deployments that were created in the user compartment
408-
self.telemetry.record_event_async(
409-
category="aqua/service/deployment", action="create", detail=model_name
410-
)
411-
# tracks the shape used for deploying the service models by name
412-
self.telemetry.record_event_async(
413-
category="aqua/service/deployment/create",
414-
action="shape",
415-
detail=instance_shape,
416-
value=model_name
417-
)
394+
model_type = "custom" if is_fine_tuned_model else "service"
395+
deployment_id = deployment.dsc_model_deployment.id
396+
telemetry_kwargs = (
397+
{"ocid": deployment_id[-8:]} if len(deployment_id) > 8 else {}
398+
)
399+
# tracks unique deployments that were created in the user compartment
400+
self.telemetry.record_event_async(
401+
category=f"aqua/{model_type}/deployment",
402+
action="create",
403+
detail=model_name,
404+
**telemetry_kwargs,
405+
)
406+
# tracks the shape used for deploying the custom or service models by name
407+
self.telemetry.record_event_async(
408+
category=f"aqua/{model_type}/deployment/create",
409+
action="shape",
410+
detail=instance_shape,
411+
value=model_name,
412+
)
418413

419414
return AquaDeployment.from_oci_model_deployment(
420415
deployment.dsc_model_deployment, self.region
@@ -461,6 +456,18 @@ def list(self, **kwargs) -> List["AquaDeployment"]:
461456
)
462457
)
463458

459+
# log telemetry if MD is in active or failed state
460+
deployment_id = model_deployment.id
461+
state = model_deployment.lifecycle_state.upper()
462+
if state in ["ACTIVE", "FAILED"]:
463+
# tracks unique deployments that were listed in the user compartment
464+
self.telemetry.record_event_async(
465+
category=f"aqua/deployment",
466+
action="list",
467+
detail=deployment_id[-8:] if len(deployment_id) > 8 else "",
468+
value=state,
469+
)
470+
464471
# tracks number of times deployment listing was called
465472
self.telemetry.record_event_async(category="aqua/deployment", action="list")
466473

0 commit comments

Comments
 (0)