-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ML: Add upgrade mode docs, hlrc, and fix bug #37942
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
benwtrent
merged 8 commits into
elastic:master
from
benwtrent:feature/ml-upgrade-mode-docs
Jan 30, 2019
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7d403f6
ML: Add upgrade mode docs, hlrc, and fix bug
benwtrent d260f9e
[DOCS] Fixes build error and edits text
lcawl b33c236
adjusting docs
benwtrent bece9f4
Merge branch 'master' into feature/ml-upgrade-mode-docs
benwtrent 66eead2
Merge branch 'feature/ml-upgrade-mode-docs' of github.com:benwtrent/e…
benwtrent 5f53b0f
Update docs/reference/ml/apis/set-upgrade-mode.asciidoc
lcawl 5f97613
Update set-upgrade-mode.asciidoc
benwtrent 44c62e2
Update set-upgrade-mode.asciidoc
benwtrent 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
93 changes: 93 additions & 0 deletions
93
client/rest-high-level/src/main/java/org/elasticsearch/client/ml/SetUpgradeModeRequest.java
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 |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /* | ||
| * Licensed to Elasticsearch under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.elasticsearch.client.ml; | ||
|
|
||
| import org.elasticsearch.action.ActionRequest; | ||
| import org.elasticsearch.action.ActionRequestValidationException; | ||
| import org.elasticsearch.common.ParseField; | ||
| import org.elasticsearch.common.unit.TimeValue; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Sets ML into upgrade_mode | ||
| */ | ||
| public class SetUpgradeModeRequest extends ActionRequest { | ||
|
|
||
|
|
||
| public static final ParseField ENABLED = new ParseField("enabled"); | ||
| public static final ParseField TIMEOUT = new ParseField("timeout"); | ||
|
|
||
| private boolean enabled; | ||
| private TimeValue timeout; | ||
|
|
||
| /** | ||
| * Create a new request | ||
| * | ||
| * @param enabled whether to enable `upgrade_mode` or not | ||
| */ | ||
| public SetUpgradeModeRequest(boolean enabled) { | ||
| this.enabled = enabled; | ||
| } | ||
|
|
||
| public boolean isEnabled() { | ||
| return enabled; | ||
| } | ||
|
|
||
| public void setEnabled(boolean enabled) { | ||
| this.enabled = enabled; | ||
| } | ||
|
|
||
| public TimeValue getTimeout() { | ||
| return timeout; | ||
| } | ||
|
|
||
| /** | ||
| * How long to wait for the request to be completed | ||
| * | ||
| * @param timeout default value of 30 seconds | ||
| */ | ||
| public void setTimeout(TimeValue timeout) { | ||
| this.timeout = timeout; | ||
| } | ||
|
|
||
| @Override | ||
| public ActionRequestValidationException validate() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(enabled, timeout); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object other) { | ||
| if (this == other) { | ||
| return true; | ||
| } | ||
|
|
||
| if (other == null || getClass() != other.getClass()) { | ||
| return false; | ||
| } | ||
|
|
||
| SetUpgradeModeRequest that = (SetUpgradeModeRequest) other; | ||
| return Objects.equals(enabled, that.enabled) && Objects.equals(timeout, that.timeout); | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| -- | ||
| :api: set-upgrade-mode | ||
| :request: SetUpgradeModeRequest | ||
| :response: AcknowledgedResponse | ||
| -- | ||
| [id="{upid}-{api}"] | ||
| === Set Upgrade Mode API | ||
|
|
||
| The Set Upgrade Mode API temporarily halts all {ml} job and {dfeed} tasks when `enabled=true`. Their | ||
| reported states remain unchanged. Consequently, when exiting upgrade mode the halted {ml} jobs and | ||
| {dfeeds} will return to their previous state. | ||
|
|
||
| It accepts a +{request}+ object and responds with a +{response}+ object. | ||
|
|
||
| When `enabled=true`, no new jobs can be opened, and no job or {dfeed} tasks will | ||
| be running. Be sure to set `enabled=false` once upgrade actions are completed. | ||
|
|
||
| [id="{upid}-{api}-request"] | ||
| ==== Set Upgrade Mode Request | ||
|
|
||
| A +{request}+ object gets created setting the desired `enabled` state. | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests-file}[{api}-request] | ||
| -------------------------------------------------- | ||
| <1> Constructing a new request referencing enabling upgrade mode | ||
| <2> Optionally setting the `timeout` value for how long the | ||
| execution should wait. | ||
|
|
||
| [id="{upid}-{api}-response"] | ||
| ==== Set Upgrade Mode Response | ||
|
|
||
| ["source","java",subs="attributes,callouts,macros"] | ||
| -------------------------------------------------- | ||
| include-tagged::{doc-tests-file}[{api}-response] | ||
| -------------------------------------------------- | ||
| <1> `isAcknowledged()` from the +{response}+ indicates if the setting was set successfully. | ||
|
|
||
| include::../execution.asciidoc[] |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.