-
Notifications
You must be signed in to change notification settings - Fork 165
[Bug fixes] Fix ListIndexTool and SearchIndexTool #3720
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
Conversation
Signed-off-by: Yaliang Wu <[email protected]>
Signed-off-by: Yaliang Wu <[email protected]>
Signed-off-by: Yaliang Wu <[email protected]>
Signed-off-by: Pavan Yekbote <[email protected]>
Signed-off-by: Pavan Yekbote <[email protected]>
Signed-off-by: Pavan Yekbote <[email protected]>
@@ -693,6 +693,7 @@ private static void runTool( | |||
tools.get(action).run(parameters, toolListener); // run tool | |||
} | |||
} catch (Exception e) { | |||
log.error("Failed to run tool {}", action, e); |
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.
the next line, the error message will be return to the listener, and it's going to be the same e.getMessage(). is the log needed?
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.
listener behavior might change over time and may not expose these details, so i think its better to explicitly log tool failure here irrespective of 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.
Log is for debugging if later we need to deep dive to identify the root cause. And listener is for customer to be notified at that very moment.
ml-algorithms/src/main/java/org/opensearch/ml/engine/tools/IndexMappingTool.java
Show resolved
Hide resolved
final String[] indices = indexList.toArray(Strings.EMPTY_ARRAY); | ||
if (indexList.isEmpty()) { | ||
@SuppressWarnings("unchecked") | ||
T empty = (T) ("There were no results searching the index parameter [" + parameters.get("index") + "]."); |
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.
how do you know this guarantee that T is actually String. Otherwise this will cause a ClassCastException at runtime.
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.
This is existing code. But I think we can enhance the logic as we already know the indexList
is empty
ml-algorithms/src/main/java/org/opensearch/ml/engine/tools/IndexMappingTool.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Pavan Yekbote <[email protected]>
@@ -88,7 +88,7 @@ public MLToolSpec(StreamInput input) throws IOException { | |||
} | |||
this.tenantId = streamInputVersion.onOrAfter(VERSION_2_19_0) ? input.readOptionalString() : null; | |||
if (input.available() > 0 && input.readBoolean()) { | |||
parameters = input.readMap(StreamInput::readString, StreamInput::readOptionalString); | |||
attributes = input.readMap(StreamInput::readString, StreamInput::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.
is it the attributes and parameters are reading the same map? what is the intention?
if (input.readBoolean()) {
parameters = input.readMap(StreamInput::readString, StreamInput::readOptionalString);
}
includeOutputInAgentResponse = input.readBoolean();
if (input.getVersion().onOrAfter(MINIMAL_SUPPORTED_VERSION_FOR_TOOL_CONFIG) && input.readBoolean()) {
configMap = input.readMap(StreamInput::readString, StreamInput::readOptionalString);
}
this.tenantId = streamInputVersion.onOrAfter(VERSION_2_19_0) ? input.readOptionalString() : null;
if (input.available() > 0 && input.readBoolean()) {
attributes = input.readMap(StreamInput::readString, StreamInput::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.
earlier, parameters was being overwritten by attributes map as we were reassigning parameters (bug)
now, we are assigning it correctly to attributes
attributes map is the last item in the bytestream, readMap() is a method that allows populating a map from the bytestream
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 am noticing some weird behavior in a multi-node cluster, will validate and get back
***resolved, the issue was with reading attributes twice, this code is still valid
Signed-off-by: Pavan Yekbote <[email protected]>
PS: 46481bd introduces a new agent type and does not have any test coverage. We plan to release this as an experimental feature. For GA, we will be adding UTs and ITs to cover most scenarios. This PR fixes a few bugs from the original commit. |
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.
approve to unblock 3.0 beta release. will watch at least one CI pass. Please add IT and UT at 3.0 GA to validate the functionalities
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.
@pyek-bot Can you update the unit tests with attributes on these 3 tools?
Signed-off-by: Pavan Yekbote <[email protected]>
Signed-off-by: Pavan Yekbote <[email protected]>
@yuye-aws Added some basic UT to validate if attributes has This was created in the previous commit: 46481bd As mentioned in my previous comment, we plan to release this as an experimental feature. For GA, we will be adding UTs and ITs to cover most scenarios including attributes. |
…#3720) Signed-off-by: Abdul Muneer Kolarkunnu <[email protected]>
Description
Fixes the description and mapping associated with these tools:
Check List
--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.