Skip to content

Commit 8dc7bba

Browse files
Adding available shapes API for model deployment
1 parent e30e3fa commit 8dc7bba

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

ads/aqua/extension/ui_handler.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def get(self, id=""):
6868
return self.list_buckets()
6969
elif paths.startswith("aqua/job/shapes"):
7070
return self.list_job_shapes()
71+
elif paths.startswith("aqua/modeldeployment/shapes"):
72+
return self.list_model_deployment_shapes()
7173
elif paths.startswith("aqua/vcn"):
7274
return self.list_vcn()
7375
elif paths.startswith("aqua/subnets"):
@@ -160,6 +162,15 @@ def list_job_shapes(self, **kwargs):
160162
AquaUIApp().list_job_shapes(compartment_id=compartment_id, **kwargs)
161163
)
162164

165+
def list_model_deployment_shapes(self, **kwargs):
166+
"""Lists model deployment shapes available in the specified compartment."""
167+
compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID)
168+
return self.finish(
169+
AquaUIApp().list_model_deployment_shapes(
170+
compartment_id=compartment_id, **kwargs
171+
)
172+
)
173+
163174
def list_vcn(self, **kwargs):
164175
"""Lists the virtual cloud networks (VCNs) in the specified compartment."""
165176
compartment_id = self.get_argument("compartment_id", default=COMPARTMENT_OCID)
@@ -255,8 +266,9 @@ def post(self, *args, **kwargs):
255266
__handlers__ = [
256267
("logging/?([^/]*)", AquaUIHandler),
257268
("compartments/?([^/]*)", AquaUIHandler),
258-
# TODO: change url to evaluation/experiements/?([^/]*)
269+
# TODO: change url to evaluation/experiments/?([^/]*)
259270
("experiment/?([^/]*)", AquaUIHandler),
271+
("modeldeployment/?([^/]*)", AquaUIHandler),
260272
("versionsets/?([^/]*)", AquaUIHandler),
261273
("buckets/?([^/]*)", AquaUIHandler),
262274
("job/shapes/?([^/]*)", AquaUIHandler),

ads/aqua/ui.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@ def _is_bucket_versioned(response):
481481

482482
@telemetry(entry_point="plugin=ui&action=list_job_shapes", name="aqua")
483483
def list_job_shapes(self, **kwargs) -> list:
484-
"""Lists all availiable job shapes for the specified compartment.
484+
"""Lists all available job shapes for the specified compartment.
485485
486486
Parameters
487487
----------
488488
**kwargs
489-
Addtional arguments, such as `compartment_id`,
489+
Additional arguments, such as `compartment_id`,
490490
for `list_job_shapes <https://docs.oracle.com/en-us/iaas/tools/python/2.122.0/api/data_science/client/oci.data_science.DataScienceClient.html#oci.data_science.DataScienceClient.list_job_shapes>`_
491491
492492
Returns
@@ -500,6 +500,28 @@ def list_job_shapes(self, **kwargs) -> list:
500500
).data
501501
return sanitize_response(oci_client=self.ds_client, response=res)
502502

503+
@telemetry(entry_point="plugin=ui&action=list_model_deployment_shapes", name="aqua")
504+
def list_model_deployment_shapes(self, **kwargs) -> list:
505+
"""Lists all available shapes for model deployment in the specified compartment.
506+
507+
Parameters
508+
----------
509+
**kwargs
510+
Additional arguments, such as `compartment_id`,
511+
for `list_model_deployment_shapes <https://docs.oracle.com/en-us/iaas/api/#/en/data-science/20190101/ModelDeploymentShapeSummary/ListModelDeploymentShapes>`_
512+
513+
Returns
514+
-------
515+
str has json representation of `oci.data_science.models.ModelDeploymentShapeSummary`."""
516+
compartment_id = kwargs.pop("compartment_id", COMPARTMENT_OCID)
517+
logger.info(
518+
f"Loading model deployment shape summary from compartment: {compartment_id}"
519+
)
520+
res = self.ds_client.list_model_deployment_shapes(
521+
compartment_id=compartment_id, **kwargs
522+
).data
523+
return sanitize_response(oci_client=self.ds_client, response=res)
524+
503525
@telemetry(entry_point="plugin=ui&action=list_vcn", name="aqua")
504526
def list_vcn(self, **kwargs) -> list:
505527
"""Lists the virtual cloud networks (VCNs) in the specified compartment.

0 commit comments

Comments
 (0)