Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename APIs for model serving framework #159

Merged
merged 13 commits into from
May 31, 2023

Conversation

AlibiZhenis
Copy link
Contributor

@AlibiZhenis AlibiZhenis commented May 4, 2023

Issues Resolved

Closes #122

Check List

  • New functionality includes testing.
    • All tests pass
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@AlibiZhenis
Copy link
Contributor Author

Since some function names were also changed in ML Commons, should I also change the method names?

@codecov-commenter
Copy link

codecov-commenter commented May 4, 2023

Codecov Report

Merging #159 (3a7d72b) into main (3f15848) will increase coverage by 0.08%.
The diff coverage is 85.18%.

@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   90.67%   90.76%   +0.08%     
==========================================
  Files          36       36              
  Lines        3989     4027      +38     
==========================================
+ Hits         3617     3655      +38     
  Misses        372      372              
Impacted Files Coverage Δ
opensearch_py_ml/ml_commons/ml_commons_client.py 79.33% <83.67%> (+4.64%) ⬆️
opensearch_py_ml/ml_commons/ml_common_utils.py 100.00% <100.00%> (ø)
opensearch_py_ml/ml_commons/model_uploader.py 97.70% <100.00%> (ø)

... and 1 file with indirect coverage changes

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@dhrubo-os
Copy link
Collaborator

Can you join to the meeting?

AlibiZhenis and others added 2 commits May 12, 2023 20:20
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@dhrubo-os
Copy link
Collaborator

codecov/patch is failing. Please check if you can address this or not. If you think some line's not possible to cover may be we can check how to skip those lines for testing may be?

@AlibiZhenis
Copy link
Contributor Author

I don't quite understand the error. It says some lines were not covered in tests, but I'm not sure what it means. For example, it says line 130 in ml_commons_client.py was not covered in tests. But it's a part of a method that was used in tests. Can you clarify?

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@@ -0,0 +1,6 @@
Register Pretrained Model
==================
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to cover ====== all the way to Model.

Load Model
~~~~~~~~~~
.. toctree::
:maxdepth: 2

api/ml_commons_load_api

Deploy Model
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.


# loading the model chunks from model index
if deploy_model:
self.deploy_model(model_id, wait_until_deployed=wait_until_deployed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For line 129, it is saying coverage is missing.

Can you please check if there's any test method for register_model where we provide deploy_model = True?

I found one test method where deploy_model = False. May be we need to add another test method for deploy_model = True ?

@@ -138,53 +236,94 @@ def _send_model_info(self, model_meta_json: dict):
if status["state"] != "CREATED":
task_flag = True
if not task_flag:
raise TimeoutError("Uploading model timed out")
raise TimeoutError("Model registration timed out")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is hard to achieve in test. May be we can create a task and then set the end = 0 or low number so that task_flag remains false and then code coverage will be achieved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIMEOUT is a constant. To do this, we would need to add a TIMEOUT argument to the function. Should I do it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh I see. Hmm, let's add TODO in the code saying "need to add the test case later" for all these. We will revisit later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Sorry for missing the meeting. I'l add the comment.

print("Model was loaded into memory only partially")
if model_state == "DEPLOYED":
print("Model deployed successfully")
elif model_state == "PARTIALLY_DEPLOYED":
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is hard to achieve. May be we can skip this for now.

else:
raise Exception("Model load failed")
raise Exception("Model deployment failed")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be covered in test, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how I can force the deployment to fail

if model_state == "DEPLOYED":
print("Model deployed successfully")
elif model_state == "PARTIALLY_DEPLOYED":
print("Model deployed only partially")
Copy link
Collaborator

Choose a reason for hiding this comment

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

skip this for now.


API_BODY = {}
if len(node_ids) > 0:
API_BODY["node_ids"] = node_ids
Copy link
Collaborator

Choose a reason for hiding this comment

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

skip this for now also.

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@AlibiZhenis AlibiZhenis mentioned this pull request May 18, 2023
4 tasks
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@@ -6,7 +6,7 @@
# GitHub history for details.

ML_BASE_URI = "/_plugins/_ml"
MODEL_UPLOAD_CHUNK_SIZE = 10_000_000
MODEL_REGISTER_CHUNK_SIZE = 10_000_000
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about change to MODEL_CHUNK_SIZE_LIMIT

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or to match the MODEL_MAX_SIZE, another option is MODEL_CHUNK_MAX_SIZE ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
@dhrubo-os dhrubo-os merged commit 7d01104 into opensearch-project:main May 31, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 31, 2023
* renaming APIs for OS 2.7

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* updating tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* linting

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* adding new methods and marking old ones as deprecated

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* fixing tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* updating documentation

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* partially fixing tests for codecov/patch

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* adding comments

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* change constant name

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* linting

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* fixing tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

---------

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
(cherry picked from commit 7d01104)
dhrubo-os pushed a commit that referenced this pull request May 31, 2023
* renaming APIs for OS 2.7

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* updating tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* linting

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* adding new methods and marking old ones as deprecated

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* fixing tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* updating documentation

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* partially fixing tests for codecov/patch

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* adding comments

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* change constant name

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* linting

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

* fixing tests

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>

---------

Signed-off-by: Alibi Zhenis <alibizhenis4@gmail.com>
(cherry picked from commit 7d01104)

Co-authored-by: Alibi Zhenis <92104549+AlibiZhenis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Rename APIs for model serving framework
5 participants