[ML] add new snapshot upgrader API for upgrading older snapshots (#64665)

This new API provides a way for users to upgrade their own anomaly job
model snapshots.

To upgrade a snapshot the following is done:
- Open a native process given the job id and the desired snapshot id
- load the snapshot to the process
- write the snapshot again from the native task (now updated via the
  native process)

relates #64154
This commit is contained in:
Benjamin Trent 2020-11-12 10:45:56 -05:00 committed by GitHub
parent 7cb8de4f18
commit 33de89d94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 3343 additions and 175 deletions

View file

@ -0,0 +1,44 @@
--
:api: upgrade-job-model-snapshot
:request: UpgradeJobModelSnapshotRequest
:response: UpgradeJobModelSnapshotResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Upgrade job snapshot API
Upgrades a previously stored {ml} model snapshot to the
current major version.
It accepts an +{request}+ object and responds
with an +{response}+ object.
[id="{upid}-{api}-request"]
==== Upgrade job snapshots request
A +{request}+ requires the following arguments:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> The job that owns the snapshot
<2> The snapshot id to upgrade
<3> The time out of the request. When `wait_for_completion` is `false` the timeout value is
applied to the time it takes for the task to be assigned to a node. When `wait_for_completion`
is `true` this timeout applies for the whole upgrade process. The default value is `30m`
<4> When true, this causes the request to not return until the upgrade is complete.
Otherwise, the response returns as soon as the task
is assigned to a node. The default is false.
[id="{upid}-{api}-response"]
==== Upgrade job snapshot response
A +{response}+ contains information on if the request was completed and its assigned node.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Was the upgrade completed
<2> What is the assigned node if the task is not completed

View file

@ -344,6 +344,7 @@ The Java High Level REST Client supports the following {ml} APIs:
* <<{upid}-update-datafeed>>
* <<{upid}-update-filter>>
* <<{upid}-update-model-snapshot>>
* <<{upid}-upgrade-job-model-snapshot>>
// CLOSE
include::ml/close-job.asciidoc[]
@ -421,6 +422,7 @@ include::ml/update-data-frame-analytics.asciidoc[]
include::ml/update-datafeed.asciidoc[]
include::ml/update-filter.asciidoc[]
include::ml/update-model-snapshot.asciidoc[]
include::ml/upgrade-job-model-snapshot.asciidoc[]
== Migration APIs