-
Notifications
You must be signed in to change notification settings - Fork 138
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
return model id in registering remote model #1329
Conversation
Signed-off-by: Xun Zhang <[email protected]>
Codecov Report
@@ Coverage Diff @@
## 2.x #1329 +/- ##
============================================
- Coverage 79.46% 78.60% -0.87%
+ Complexity 2273 2272 -1
============================================
Files 190 190
Lines 9167 9250 +83
Branches 906 909 +3
============================================
- Hits 7285 7271 -14
- Misses 1472 1569 +97
Partials 410 410
Flags with carried forward coverage won't be shown. Click here to find out more.
|
this.taskId = in.readString(); | ||
this.status = in.readString(); | ||
this.modelId = in.readOptionalString(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like a good improvement for remote models, do we really have a taskId which is doing real work for remote models?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have a actual task id. It will do some validation work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious what kind of validations ?
@@ -249,8 +250,8 @@ private void registerModel(MLRegisterModelInput registerModelInput, ActionListen | |||
mlTaskManager.createMLTask(mlTask, ActionListener.wrap(response -> { | |||
String taskId = response.getId(); | |||
mlTask.setTaskId(taskId); | |||
mlModelManager.registerMLModel(registerModelInput, mlTask); | |||
listener.onResponse(new MLRegisterModelResponse(taskId, MLTaskState.CREATED.name())); | |||
System.out.println("mlModelManager calls registerMLRemoteModel"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Probably unintended?
Same at L236
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I think I forgot to delete. They will be cleaned up for sure.
@@ -249,8 +250,8 @@ private void registerModel(MLRegisterModelInput registerModelInput, ActionListen | |||
mlTaskManager.createMLTask(mlTask, ActionListener.wrap(response -> { | |||
String taskId = response.getId(); | |||
mlTask.setTaskId(taskId); | |||
mlModelManager.registerMLModel(registerModelInput, mlTask); | |||
listener.onResponse(new MLRegisterModelResponse(taskId, MLTaskState.CREATED.name())); | |||
System.out.println("mlModelManager calls registerMLRemoteModel"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we keeping this line?
@@ -233,6 +233,7 @@ private void registerModel(MLRegisterModelInput registerModelInput, ActionListen | |||
throw new IllegalArgumentException("URL can't match trusted url regex"); | |||
} | |||
} | |||
System.out.println("registering the model"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we keeping this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid using system out print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I guarante these redundant lines will be removed in my next PR.
return (int) modelGroupSourceMap.get(MLModelGroup.LATEST_VERSION_FIELD) + 1; | ||
} | ||
|
||
private void indexRemoteModel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the other method: private void indexRemoteModel(MLRegisterModelInput registerModelInput, MLTask mlTask, String modelVersion)
as we are invoking this method only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's needed for registering non-remote models. Actually if you use the other method, the model_id will not be included and the model registering could be asynchronize.
); | ||
|
||
client.update(updateModelGroupRequest, ActionListener.wrap(r -> { | ||
uploadMLModelMeta(mlRegisterModelMetaInput, updatedVersion + "", listener); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding : updatedVersion + ""
if the goal is to convert int to string, may be we can follow standard way like: Integer.toString(updatedVersion)
?
mlModelManager.registerMLModel(registerModelInput, mlTask); | ||
listener.onResponse(new MLRegisterModelResponse(taskId, MLTaskState.CREATED.name())); | ||
System.out.println("mlModelManager calls registerMLRemoteModel"); | ||
mlModelManager.registerMLRemoteModel(registerModelInput, mlTask, listener); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the expectation that, only remote model registration will be asynchronous? If yes, can we please add a comment here also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the opposite, remote model registration is synchronous only so the model_id can be returned right away. Comments will be added in the next PR.
Description
This change only applies to registering remote models. Registering a remote model doesn't need Asynchronize, it should return model_id right away in the response.
Before this change:
POST /_plugins/_ml/models/_register
{
"name": "openAI-GPT-3.5 completions",
"function_name": "remote",
"description": "test model",
"connector_id": "kUFFL4kB4ubqQRzeQ_r-"
}
Response:
{
"task_id": "l0FIL4kB4ubqQRzeKvpV",
"status": "CREATED"
}
After this change:
POST /_plugins/_ml/models/_register
{
"name": "openAI-GPT-3.5 completions",
"function_name": "remote",
"description": "test model",
"connector_id": "kUFFL4kB4ubqQRzeQ_r-"
}
Response:
{
"task_id": "l0FIL4kB4ubqQRzeKvpV",
"status": "CREATED",
"model_id": "xxxxxxxxxxxxxx",
}