-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add resource stats to task framework #2089
Add resource stats to task framework #2089
Conversation
Can one of the admins verify this patch? |
✅ Gradle Check success fa63613384c4b3e2e19f41b58cd76f175396ad62 |
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.
Would it simplify things to make ResourceStats
a class that is composed of a collection of ResourceStat
? From a cursory overview, It feels like it would move serialization into the class along with other helper methods that operate on the collection of stats, simplify usage, and make some of the enums child classes of ResourceStat
. It would also enable extending resource stats in the future into something more than just a map of string/value.
I agree. In general, when you find yourself creating things like |
client/rest-high-level/src/test/java/org/opensearch/client/tasks/CancelTasksResponseTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/tasks/CancelTasksResponseTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/action/admin/cluster/node/tasks/TaskTests.java
Show resolved
Hide resolved
@dblock @andrross
The structure would look like this,
Note:
Any thoughts? |
fa63613
to
8e9f1bb
Compare
❌ Gradle Check failure 8e9f1bbb2d5b9b8116831fa021c756051cecc170 |
da4b58b
to
e8ecfd0
Compare
❌ Gradle Check failure da4b58b61e789b2a18474956212ae37610a99eec |
67d10ce
to
6f2ebcd
Compare
❌ Gradle Check failure e8ecfd06c0206c9a52e33fe4aa7dd3f718fe6111 |
❌ Gradle Check failure 67d10ce640623c17d9fb5fafd52c47fc2444739e |
❌ Gradle Check failure 6f2ebcd240d4dbc6cdb530bb33ab9cc8f5799534 |
6f2ebcd
to
5da6e8a
Compare
❌ Gradle Check failure 5da6e8a5983215f35ebe928581363815a6fdc8c0 |
5da6e8a
to
0bbad3d
Compare
❌ Gradle Check failure 0bbad3d8edb27fa524c3fb9800a8709a21045fe6 |
0bbad3d
to
9cca9ea
Compare
❌ Gradle Check failure 9cca9ea49d21a82450fd73dc1fb6b025502d4779 |
server/src/main/java/org/opensearch/tasks/TaskCompleteResourceInfo.java
Outdated
Show resolved
Hide resolved
Is it a bad thing to write custom parsing logic? The option you presented above as "current approach" is I believe the correct way to structure the JSON. The question here is how to model Java code. The approaches I would consider are:
|
server/src/main/java/org/opensearch/tasks/TaskResourceInfo.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/tasks/TaskCompleteResourceInfo.java
Outdated
Show resolved
Hide resolved
.../main/java/org/opensearch/action/admin/cluster/node/tasks/list/TransportListTasksAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/tasks/TaskCompleteResourceInfo.java
Outdated
Show resolved
Hide resolved
Signed-off-by: sruti1312 <srutiparthiban@gmail.com>
78880ef
to
b64ce26
Compare
❌ Gradle Check failure 78880ef84769b0309430c34d34032f5b3dbf81e2 |
@Bukhtawar you're good with this? |
We will revisit as needed, no immediate blockers for merge |
@sruti1312 Do we want this in 2.0? 2.x? Let's label backports if so. |
I labeled to backport 2.x and 2.0, we have auto-backport going on. |
* Add resource stats to task framework Signed-off-by: sruti1312 <srutiparthiban@gmail.com> * Update thread resource info and add tests Signed-off-by: sruti1312 <srutiparthiban@gmail.com> (cherry picked from commit 8b997c1)
* Add resource stats to task framework Signed-off-by: sruti1312 <srutiparthiban@gmail.com> * Update thread resource info and add tests Signed-off-by: sruti1312 <srutiparthiban@gmail.com> (cherry picked from commit 8b997c1)
return taskInfo(localNodeId, description, status); | ||
if (excludeStats == false) { | ||
resourceStats = new TaskResourceStats(new HashMap<>() { | ||
{ |
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.
We probably should not create a new class for that: new TaskResourceStats(Collections.singletonMap(TOTAL, getTotalResourceStats()))
Adds resource stats to task framework Signed-off-by: sruti1312 <srutiparthiban@gmail.com> Signed-off-by: Nicholas Walter Knize <nknize@apache.org> (cherry picked from commit 8b997c1)
Adds resource stats to task framework Signed-off-by: sruti1312 <srutiparthiban@gmail.com> Signed-off-by: Nicholas Walter Knize <nknize@apache.org> (cherry picked from commit 8b997c1)
Backporting pull requests opensearch-project#2089 and opensearch-project#3982 Signed-off-by: PritLadani <pritkladani@gmail.com>
Signed-off-by: sruti1312 srutiparthiban@gmail.com
Description
Add resource stats to task framework. The task expose interfaces to allow updating the resource stats.
Sample task response:
Issues Resolved
This is used for task resource tracking.
#1009
#1329
Check List
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.