mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: ML Close Job (#32943)
* HLRC: Adding ML Close Job API HLRC: Adding ML Close Job API * reconciling request converters * Adding serialization tests and addressing PR comments * Changing constructor order
This commit is contained in:
parent
9050c7e846
commit
3fbaae10af
12 changed files with 623 additions and 2 deletions
59
docs/java-rest/high-level/ml/close-job.asciidoc
Normal file
59
docs/java-rest/high-level/ml/close-job.asciidoc
Normal file
|
@ -0,0 +1,59 @@
|
|||
[[java-rest-high-x-pack-ml-close-job]]
|
||||
=== Close Job API
|
||||
|
||||
The Close Job API provides the ability to close {ml} jobs in the cluster.
|
||||
It accepts a `CloseJobRequest` object and responds
|
||||
with a `CloseJobResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-close-job-request]]
|
||||
==== Close Job Request
|
||||
|
||||
A `CloseJobRequest` object gets created with an existing non-null `jobId`.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-close-job-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing existing job IDs
|
||||
<2> Optionally used to close a failed job, or to forcefully close a job
|
||||
which has not responded to its initial close request.
|
||||
<3> Optionally set to ignore if a wildcard expression matches no jobs.
|
||||
(This includes `_all` string or when no jobs have been specified)
|
||||
<4> Optionally setting the `timeout` value for how long the
|
||||
execution should wait for the job to be closed.
|
||||
|
||||
[[java-rest-high-x-pack-ml-close-job-execution]]
|
||||
==== Execution
|
||||
|
||||
The request can be executed through the `MachineLearningClient` contained
|
||||
in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-close-job-execute]
|
||||
--------------------------------------------------
|
||||
<1> `isClosed()` from the `CloseJobResponse` indicates if the job was successfully
|
||||
closed or not.
|
||||
|
||||
[[java-rest-high-x-pack-ml-close-job-execution-async]]
|
||||
==== Asynchronous Execution
|
||||
|
||||
The request can also be executed asynchronously:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-close-job-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `CloseJobRequest` to execute and the `ActionListener` to use when
|
||||
the execution completes
|
||||
|
||||
The method does not block and returns immediately. The passed `ActionListener` is used
|
||||
to notify the caller of completion. A typical `ActionListener` for `CloseJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-close-job-listener]
|
||||
--------------------------------------------------
|
||||
<1> `onResponse` is called back when the action is completed successfully
|
||||
<2> `onFailure` is called back when some unexpected error occurs
|
|
@ -44,7 +44,7 @@ include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-exec
|
|||
the execution completes
|
||||
|
||||
The method does not block and returns immediately. The passed `ActionListener` is used
|
||||
to notify the caller of completion. A typical `ActionListner` for `OpenJobResponse` may
|
||||
to notify the caller of completion. A typical `ActionListener` for `OpenJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
|
|
|
@ -207,10 +207,12 @@ The Java High Level REST Client supports the following Machine Learning APIs:
|
|||
* <<java-rest-high-x-pack-ml-put-job>>
|
||||
* <<java-rest-high-x-pack-ml-delete-job>>
|
||||
* <<java-rest-high-x-pack-ml-open-job>>
|
||||
* <<java-rest-high-x-pack-ml-close-job>>
|
||||
|
||||
include::ml/put-job.asciidoc[]
|
||||
include::ml/delete-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
include::ml/close-job.asciidoc[]
|
||||
|
||||
== Migration APIs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue