-
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] Return assigned node in start/open job/datafeed response #55473
[ML] Return assigned node in start/open job/datafeed response #55473
Conversation
Adds a "node" field to the response from the following endpoints: 1. Open anomaly detection job 2. Start datafeed 3. Start data frame analytics job If the job or datafeed is assigned to a node immediately then this field will return the ID of that node. In the case where a job or datafeed is opened or started lazily the node field will contain an empty string. Clients that want to test whether a job or datafeed was opened or started lazily can therefore check for this. Fixes elastic#54067
Pinging @elastic/ml-core (:ml) |
docs/reference/ml/anomaly-detection/apis/start-datafeed.asciidoc
Outdated
Show resolved
Hide resolved
docs/reference/ml/anomaly-detection/apis/start-datafeed.asciidoc
Outdated
Show resolved
Hide resolved
docs/reference/ml/anomaly-detection/apis/start-datafeed.asciidoc
Outdated
Show resolved
Hide resolved
docs/reference/ml/anomaly-detection/apis/start-datafeed.asciidoc
Outdated
Show resolved
Hide resolved
docs/reference/ml/anomaly-detection/apis/start-datafeed.asciidoc
Outdated
Show resolved
Hide resolved
import org.elasticsearch.common.io.stream.Writeable; | ||
import org.elasticsearch.test.AbstractWireSerializingTestCase; | ||
|
||
public class NodeAcknowledgedResponseTests extends AbstractWireSerializingTestCase<NodeAcknowledgedResponse> { |
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: might be cool to use AbstractBWCWireSerializationTestCase
instead.
...ugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java
Outdated
Show resolved
Hide resolved
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.
LGTM
|
||
static { | ||
PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), OPENED); | ||
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), NODE); | ||
} | ||
|
||
private boolean opened; |
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 the fields in this class can be final
.
@@ -71,18 +88,22 @@ public boolean equals(Object other) { | |||
} | |||
|
|||
OpenJobResponse that = (OpenJobResponse) other; | |||
return isOpened() == that.isOpened(); | |||
return isOpened() == that.isOpened() |
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: It feels inconsistent that we compare one field using the accessor and the other one directly. Could you stick to one of those styles in equals
and hashCode
?
Or maybe it would be possible to derive from AcknowledgedResponse
(it would have to become configurable wrt acknowledged
field name though...).
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.
it would have to become configurable wrt
acknowledged
field name though
I don't think this would be a good idea. We made a mistake really in not using acknowledged
as the field in this class back in 2016. We stuck to the Prelert heritage instead of making things consistent with the Elastic way. Unfortunately now making it consistent would be breaking change, and it doesn't seem like it's a big enough problem to warrant the break. But making it easier for others to be inconsistent in the future doesn't seem like a good idea.
@@ -74,18 +90,22 @@ public boolean equals(Object other) { | |||
} | |||
|
|||
StartDatafeedResponse that = (StartDatafeedResponse) other; | |||
return isStarted() == that.isStarted(); | |||
return isStarted() == that.isStarted() |
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.
Similar remark here.
Co-Authored-By: Lisa Cawley <[email protected]> Co-Authored-By: Benjamin Trent <[email protected]>
Jenkins run elasticsearch-ci/default-distro |
Jenkins run elasticsearch-ci/default-distro |
Jenkins run elasticsearch-ci/1 |
Jenkins run elasticsearch-ci/packaging-sample-unix-docker |
Jenkins run elasticsearch-ci/1 |
Jenkins run elasticsearch-ci/packaging-sample-unix-docker |
Jenkins run elasticsearch-ci/1 |
Jenkins run elasticsearch-ci/packaging-sample-matrix-windows |
Jenkins run elasticsearch-ci/packaging-sample-unix-docker |
Jenkins run elasticsearch-ci/2 |
Adds a "node" field to the response from the following endpoints: 1. Open anomaly detection job 2. Start datafeed 3. Start data frame analytics job If the job or datafeed is assigned to a node immediately then this field will return the ID of that node. In the case where a job or datafeed is opened or started lazily the node field will contain an empty string. Clients that want to test whether a job or datafeed was opened or started lazily can therefore check for this. Backport of elastic#55473
Once elastic#55570 is merged the master branch BWC code is no longer needed. Relates elastic#55473
Adds a "node" field to the response from the following endpoints: 1. Open anomaly detection job 2. Start datafeed 3. Start data frame analytics job If the job or datafeed is assigned to a node immediately then this field will return the ID of that node. In the case where a job or datafeed is opened or started lazily the node field will contain an empty string. Clients that want to test whether a job or datafeed was opened or started lazily can therefore check for this. Backport of #55473
Relates: elastic/elasticsearch#55473, #4803 Co-authored-by: Russ Cam <[email protected]>
Relates: elastic/elasticsearch#55473, #4803 Co-authored-by: Russ Cam <[email protected]>
Adds a "node" field to the response from the following endpoints:
If the job or datafeed is assigned to a node immediately then
this field will return the ID of that node.
In the case where a job or datafeed is opened or started lazily
the node field will contain an empty string. Clients that want
to test whether a job or datafeed was opened or started lazily
can therefore check for this.
Fixes #54067