Skip to content

Conversation

@VipulMascarenhas
Copy link
Member

@VipulMascarenhas VipulMascarenhas commented Jan 27, 2024

Description

Jira ticket: ODSC-51354

The code changes in this PR an Aqua model deployment. Following changes are done:

  1. Creating a new handler called deployment_handler.py. The handler accepts post request and there are a few required parameters that caller will have to provide (need comments on what can be optional).
  2. In deployment.py, implemented create() functionality. It does not create a catalog entry right now (needs AquaModel.create implemented - either mock or otherwise), so assumes a few attributes will be available (image, model id, entrypoint) but this will be removed. (need comments on what deployment config needs to be hardcoded vs. expected from caller).
  3. Added Errors class in base_handler, but this will be removed once Error handler PR goes though.
  4. Added support for serializing dataclass using ads.common.serializer.DataClassSerializable for CLI commands.

User can invoke create by calling:

curl -X POST -H "Content-Type: application/json" -d '{"compartment_id": "ocid1.compartment.oc1..xxx", "project_id": "ocid1.datascienceproject.oc1.iad.xxx", "display_name": "Test deploy via extensions", "instance_count": 1, "instance_shape": "VM.Standard.E4.Flex", "log_group_id": "ocid1.loggroup.oc1.iad.xxx", "access_log_id": "ocid1.log.oc1.iad.xxx", "predict_log_id": "ocid1.log.oc1.iad.xxx", "model_id": "ocid1.datasciencemodel.oc1.iad.xxx"}' http://localhost:8888/aqua/deployments 

It should return a json response:

{ "display_name": "Test deploy via extensions", "aqua_service_model": "xxx.xxx.xxx.xxx.xxx#aqua_service_model_value", "state": "CREATING", "description": null, "created_on": "2024-01-27 01:46:06.593000+00:00", "created_by": "ocid1.user.oc1..xxx", "endpoint": "https://modeldeployment.us-ashburn-1.oci.customer-oci.com/ocid1.datasciencemodeldeployment.oc1.iad.xxx" } 

or, user can use cli:

ads aqua deployment create --compartment_id "ocid1.compartment.oc1..xxx" --project_id "ocid1.datascienceproject.oc1.iad.xxx" --display_name "Test aqua deploy via CLI" --instance_count 1 --instance_shape "VM.Standard.E4.Flex" --model_id "ocid1.datasciencemodel.oc1.iad.xxx" --deployment_image "iad.ocir.io/ociodscdev/aqua_deploy:1.0.0" --entrypoint '["python", "/opt/api/api.py"]' --aqua_service_model "xxx.xxx.xxx.xxx.xxx#aqua_service_model_value" --log_group_id "ocid1.loggroup.oc1.iad.xxx" --access_log_id "ocid1.log.oc1.iad.xxx" --predict_log_id "ocid1.log.oc1.iad.xxx" 

Next steps:

  • replacing hardcoded values with aqua model entries
  • tests
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 27, 2024
@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.35%

@VipulMascarenhas VipulMascarenhas changed the title [Odsc 51354] Create new Aqua deployment [ODSC 51354] Create new Aqua deployment Jan 29, 2024
@github-actions
Copy link

📌 Cov diff with main:

No success to gather report. 😿

📌 Overall coverage:

No success to gather report. 😿

@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.35%

@github-actions
Copy link

📌 Cov diff with main:

No success to gather report. 😿

📌 Overall coverage:

No success to gather report. 😿

@github-actions
Copy link

📌 Cov diff with main:

No success to gather report. 😿

📌 Overall coverage:

No success to gather report. 😿

@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.35%

@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.31%

@dataclass
class AquaDeployment:
"""Represents an Aqua Model Deployment"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add ocid as well?

Copy link
Member Author

@VipulMascarenhas VipulMascarenhas Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during the design discussion we decided to have that in the aqua_service_model tag (ocid#model_name). We can have a separate field, but could get redundant due to the tag. Tracking this in a separate page here.

else None
)
if aqua_service_model:
results.append(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have something like

AquaDeployment.from_oci_model(...) 

try:
model_deployment = self.client.get_model_deployment(**kwargs).data
except ServiceError as se:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we add everywhere these exception statements, probably would be better to move them into the decorator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we'll revisit this and update the code once the error handler is finalized.

f"Target deployment {model_deployment.id} is not Aqua deployment."
)

return AquaDeployment(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: AquaDeployment.from_oci_model()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, makes sense. will add it in a separate PR.

raise HTTPError(400, Errors.NO_INPUT_DATA)

# required input parameters
compartment_id = input_data.get("compartment_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For parameters it will be automatically handled, right?


# required input parameters
compartment_id = input_data.get("compartment_id")
if not compartment_id:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add some MDRequest dataclass and put all of the logic with constructing the input attributes and validation there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. will add it in a separate PR.

aqua_service_model = f"xxx.xxx.xxx.xxx.xxx#aqua_service_model_value"

self.finish(
AquaDeploymentApp().create(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have MDRequest dataclass, then the code could be

AquaDeploymentApp().create(**md_request.to_dict()) 
@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.31%

@VipulMascarenhas VipulMascarenhas merged commit decbfa7 into feature/aqua Jan 31, 2024
@VipulMascarenhas VipulMascarenhas deleted the ODSC-51354/create_new_deployment branch January 31, 2024 02:43
@github-actions
Copy link

📌 Cov diff with main:

Coverage-1%

📌 Overall coverage:

Coverage-23.32%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

3 participants