Skip to content

Commit

Permalink
[ML] Remove deprecated force parameter. (#46361)
Browse files Browse the repository at this point in the history
The force parameter was removed from start actions in elastic/elasticsearch#46414. This reflects the change in the UI API calls.
  • Loading branch information
walterra authored Oct 2, 2019
1 parent 28c4bbf commit 7279f06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
5 changes: 1 addition & 4 deletions x-pack/legacy/plugins/ml/server/client/elasticsearch_ml.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,11 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
ml.startDataFrameTransform = ca({
urls: [
{
fmt: '/_data_frame/transforms/<%=transformId%>/_start?&force=<%=force%>',
fmt: '/_data_frame/transforms/<%=transformId%>/_start',
req: {
transformId: {
type: 'string'
},
force: {
type: 'boolean'
}
}
}
],
Expand Down
20 changes: 9 additions & 11 deletions x-pack/legacy/plugins/ml/server/models/data_frame/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ enum TRANSFORM_ACTIONS {
DELETE = 'delete',
}

interface StartStopOptions {
interface StartTransformOptions {
transformId: DataFrameTransformId;
force: boolean;
}

interface StopTransformOptions {
transformId: DataFrameTransformId;
force?: boolean;
waitForCompletion?: boolean;
}

Expand All @@ -30,11 +34,11 @@ export function transformServiceProvider(callWithRequest: callWithRequestType) {
return callWithRequest('ml.deleteDataFrameTransform', { transformId });
}

async function stopTransform(options: StartStopOptions) {
async function stopTransform(options: StopTransformOptions) {
return callWithRequest('ml.stopDataFrameTransform', options);
}

async function startTransform(options: StartStopOptions) {
async function startTransform(options: StartTransformOptions) {
return callWithRequest('ml.startDataFrameTransform', options);
}

Expand Down Expand Up @@ -86,13 +90,7 @@ export function transformServiceProvider(callWithRequest: callWithRequestType) {
for (const transformInfo of transformsInfo) {
const transformId = transformInfo.id;
try {
await startTransform({
transformId,
force:
transformInfo.state !== undefined
? transformInfo.state === DATA_FRAME_TRANSFORM_STATE.FAILED
: false,
});
await startTransform({ transformId });
results[transformId] = { success: true };
} catch (e) {
if (isRequestTimeout(e)) {
Expand Down

0 comments on commit 7279f06

Please sign in to comment.