-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[ML] Implement force deleting a data frame analytics job #50553
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
Merged
dimitris-athanasiou
merged 4 commits into
elastic:master
from
dimitris-athanasiou:force-delete-df-analytics-job
Jan 3, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
196b04d
[ML] Implement force deleting a data frame analytics job
dimitris-athanasiou 05a6d75
Fix logging statement
dimitris-athanasiou ee62dac
Update docs/reference/ml/df-analytics/apis/delete-dfanalytics.asciidoc
dimitris-athanasiou 59baccc
Update docs/reference/ml/df-analytics/apis/delete-dfanalytics.asciidoc
dimitris-athanasiou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,16 +5,16 @@ | |||||
*/ | ||||||
package org.elasticsearch.xpack.core.ml.action; | ||||||
|
||||||
import org.elasticsearch.Version; | ||||||
import org.elasticsearch.action.ActionRequestValidationException; | ||||||
import org.elasticsearch.action.ActionType; | ||||||
import org.elasticsearch.action.support.master.AcknowledgedRequest; | ||||||
import org.elasticsearch.action.support.master.AcknowledgedResponse; | ||||||
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; | ||||||
import org.elasticsearch.client.ElasticsearchClient; | ||||||
import org.elasticsearch.common.ParseField; | ||||||
import org.elasticsearch.common.io.stream.StreamInput; | ||||||
import org.elasticsearch.common.io.stream.StreamOutput; | ||||||
import org.elasticsearch.common.xcontent.ToXContentFragment; | ||||||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||||||
import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig; | ||||||
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper; | ||||||
|
||||||
|
@@ -30,13 +30,21 @@ private DeleteDataFrameAnalyticsAction() { | |||||
super(NAME, AcknowledgedResponse::new); | ||||||
} | ||||||
|
||||||
public static class Request extends AcknowledgedRequest<Request> implements ToXContentFragment { | ||||||
public static class Request extends AcknowledgedRequest<Request> { | ||||||
|
||||||
public static final ParseField FORCE = new ParseField("force"); | ||||||
|
||||||
private String id; | ||||||
private boolean force; | ||||||
|
||||||
public Request(StreamInput in) throws IOException { | ||||||
super(in); | ||||||
id = in.readString(); | ||||||
if (in.getVersion().onOrAfter(Version.CURRENT)) { | ||||||
force = in.readBoolean(); | ||||||
} else { | ||||||
force = false; | ||||||
} | ||||||
} | ||||||
|
||||||
public Request() {} | ||||||
|
@@ -49,34 +57,39 @@ public String getId() { | |||||
return id; | ||||||
} | ||||||
|
||||||
@Override | ||||||
public ActionRequestValidationException validate() { | ||||||
return null; | ||||||
public boolean isForce() { | ||||||
return force; | ||||||
} | ||||||
|
||||||
public void setForce(boolean force) { | ||||||
this.force = force; | ||||||
} | ||||||
|
||||||
@Override | ||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||||||
builder.field(DataFrameAnalyticsConfig.ID.getPreferredName(), id); | ||||||
return builder; | ||||||
public ActionRequestValidationException validate() { | ||||||
return null; | ||||||
} | ||||||
|
||||||
@Override | ||||||
public boolean equals(Object o) { | ||||||
if (this == o) return true; | ||||||
if (o == null || getClass() != o.getClass()) return false; | ||||||
DeleteDataFrameAnalyticsAction.Request request = (DeleteDataFrameAnalyticsAction.Request) o; | ||||||
return Objects.equals(id, request.id); | ||||||
return Objects.equals(id, request.id) && force == request.force; | ||||||
} | ||||||
|
||||||
@Override | ||||||
public void writeTo(StreamOutput out) throws IOException { | ||||||
super.writeTo(out); | ||||||
out.writeString(id); | ||||||
if (out.getVersion().onOrAfter(Version.CURRENT)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #nit,
Suggested change
|
||||||
out.writeBoolean(force); | ||||||
} | ||||||
} | ||||||
|
||||||
@Override | ||||||
public int hashCode() { | ||||||
return Objects.hash(id); | ||||||
return Objects.hash(id, force); | ||||||
} | ||||||
} | ||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,
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 will have to turn off BWC tests for this. I have the habit of leaving those as
CURRENT
and change them when I unmute the BWC tests after backporting.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.
@dimitris-athanasiou I can understand that, I have just noticed that using
CURRENT
allows you to backport without actually changing the version (since it still compiles).V_8_0_0
forces me to do things in the correct order.I just find this helpful, I am not gonna prevent a 👍 over it :D