-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML][Inference] PUT API #50852
[ML][Inference] PUT API #50852
Conversation
Pinging @elastic/ml-core (:ml) |
run elasticsearch-ci/docs-check |
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.
I wonder if we should version the format of the actual model definition JSON in case we want to change it later. One for discussion not necessary for this change
} | ||
|
||
/** | ||
* Get trained model config asynchronously and notifies listener upon completion |
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.
* Get trained model config asynchronously and notifies listener upon completion | |
* Put trained model config asynchronously and notifiy listener upon completion |
return deflate(reference); | ||
} | ||
|
||
public static <T> T inflate(String compressedString, |
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.
I think inflate
isn't called anywhere apart from InferenceToXContentCompressorTests
. If it goes SimpleBoundedInputStream
could also be removed?
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.
@davidkyle possibly...but I was thinking of users requesting the compressed format from elasticsearch (for faster retrieval) and only inflating locally.
@@ -111,7 +112,7 @@ public static TrainedModelConfig fromXContent(XContentParser parser) throws IOEx | |||
this.modelId = modelId; | |||
this.createdBy = createdBy; | |||
this.version = version; | |||
this.createTime = Instant.ofEpochMilli(createTime.toEpochMilli()); | |||
this.createTime = createTime == null ? null : Instant.ofEpochMilli(createTime.toEpochMilli()); |
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.
createTime
can't be null on the server side class. Are we going to set createTime
automatically on PUT if not set?
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.
I scrolled down 👍
} | ||
} | ||
|
||
validationException = checkIllegalSetting(version, VERSION.getPreferredName(), validationException); |
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.
validate()
can only be called once on PUT as the builder will set these fields so if called on a built config it will error. Maybe add a isCreateTime
flag or similar.
PutJobAction
has the same issue and does the validation of create time settings in the action
" \"version\": \"8.0.0\",\n" + | ||
" \"license_level\": \"platinum\",\n" + | ||
" \"created_by\": \"benwtrent\",\n" + | ||
" \"created_by\": \"es_test\",\n" + |
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.
" \"created_by\": \"es_test\",\n" + | |
" \"created_by\": \"benwtrent\",\n" + |
Take the glory dude
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.
HAHAHA
TrainedModelConfig trainedModelConfig = new TrainedModelConfig.Builder(request.getTrainedModelConfig()) | ||
.setVersion(Version.CURRENT) | ||
.setCreateTime(Instant.now()) | ||
.setCreatedBy("user") |
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.
I thought created by would be the users name (if security is enabled) but now I realise not. Maybe api
rather than user
. Or api_user
. Our included models are createdBy: ml_admin
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.
api_user
seems good to me.
Yeah, I don't think we should include the actual user name for security reasons. It seems like a potential to leak info. Somebody could have permissions to read trained models, but not permission to see all configured users.
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.
Maybe it would be best to match what we did for system created annotations. Otherwise we’re just creating a plethora of imaginary users and eventually someone will ask why they’re all different.
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.
@droberts195 for our internal created annotations, we use XPackUser.NAME
which is _xpack
. I am fine switching it to that in a subsequent PR.
|
||
@Override | ||
public String getName() { | ||
return "xpack_ml_put_data_frame_analytics_action"; |
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.
return "xpack_ml_put_data_frame_analytics_action"; | |
return "xpack_ml_put_trained_model_action"; |
This adds the `PUT` API for creating trained models that support our format. This includes * HLRC change for the API * API creation * Validations of model format and call
This adds the `PUT` API for creating trained models that support our format. This includes * HLRC change for the API * API creation * Validations of model format and call
This adds the
PUT
API for creating trained models that support our format.This includes