Skip to content

Commit

Permalink
update model and deployment handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
VipulMascarenhas committed Dec 10, 2024
1 parent e203222 commit 82d1ae2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
12 changes: 8 additions & 4 deletions ads/aqua/extension/deployment_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def delete(self, model_deployment_id):
return self.finish(AquaDeploymentApp().delete(model_deployment_id))

@handle_exceptions
def put(self, *args, **kwargs):
def put(self, *args, **kwargs): # noqa: ARG002
"""
Handles put request for the activating and deactivating OCI datascience model deployments
Raises
Expand All @@ -82,7 +82,7 @@ def put(self, *args, **kwargs):
raise HTTPError(400, f"The request {self.request.path} is invalid.")

@handle_exceptions
def post(self, *args, **kwargs):
def post(self, *args, **kwargs): # noqa: ARG002
"""
Handles post request for the deployment APIs
Raises
Expand Down Expand Up @@ -132,6 +132,8 @@ def post(self, *args, **kwargs):
private_endpoint_id = input_data.get("private_endpoint_id")
container_image_uri = input_data.get("container_image_uri")
cmd_var = input_data.get("cmd_var")
freeform_tags = input_data.get("freeform_tags")
defined_tags = input_data.get("defined_tags")

self.finish(
AquaDeploymentApp().create(
Expand All @@ -157,6 +159,8 @@ def post(self, *args, **kwargs):
private_endpoint_id=private_endpoint_id,
container_image_uri=container_image_uri,
cmd_var=cmd_var,
freeform_tags=freeform_tags,
defined_tags=defined_tags,
)
)

Expand Down Expand Up @@ -196,7 +200,7 @@ def validate_predict_url(endpoint):
return False

@handle_exceptions
def post(self, *args, **kwargs):
def post(self, *args, **kwargs): # noqa: ARG002
"""
Handles inference request for the Active Model Deployments
Raises
Expand Down Expand Up @@ -262,7 +266,7 @@ def get(self, model_id):
)

@handle_exceptions
def post(self, *args, **kwargs):
def post(self, *args, **kwargs): # noqa: ARG002
"""Handles post request for the deployment param handler API.
Raises
Expand Down
16 changes: 9 additions & 7 deletions ads/aqua/extension/model_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def list(self):
)

@handle_exceptions
def post(self, *args, **kwargs):
def post(self, *args, **kwargs): # noqa: ARG002
"""
Handles post request for the registering any Aqua model.
Raises
Expand Down Expand Up @@ -131,6 +131,8 @@ def post(self, *args, **kwargs):
inference_container_uri = input_data.get("inference_container_uri")
allow_patterns = input_data.get("allow_patterns")
ignore_patterns = input_data.get("ignore_patterns")
freeform_tags = input_data.get("freeform_tags")
defined_tags = input_data.get("defined_tags")

return self.finish(
AquaModelApp().register(
Expand All @@ -145,6 +147,8 @@ def post(self, *args, **kwargs):
inference_container_uri=inference_container_uri,
allow_patterns=allow_patterns,
ignore_patterns=ignore_patterns,
freeform_tags=freeform_tags,
defined_tags=defined_tags,
)
)

Expand All @@ -170,11 +174,9 @@ def put(self, id):

enable_finetuning = input_data.get("enable_finetuning")
task = input_data.get("task")
app=AquaModelApp()
app = AquaModelApp()
self.finish(
app.edit_registered_model(
id, inference_container, enable_finetuning, task
)
app.edit_registered_model(id, inference_container, enable_finetuning, task)
)
app.clear_model_details_cache(model_id=id)

Expand Down Expand Up @@ -218,7 +220,7 @@ def _find_matching_aqua_model(model_id: str) -> Optional[AquaModelSummary]:
return None

@handle_exceptions
def get(self, *args, **kwargs):
def get(self, *args, **kwargs): # noqa: ARG002
"""
Finds a list of matching models from hugging face based on query string provided from users.
Expand All @@ -239,7 +241,7 @@ def get(self, *args, **kwargs):
return self.finish({"models": models})

@handle_exceptions
def post(self, *args, **kwargs):
def post(self, *args, **kwargs): # noqa: ARG002
"""Handles post request for the HF Models APIs
Raises
Expand Down

0 comments on commit 82d1ae2

Please sign in to comment.