From 720b209cbc3371f9932f605d3c0b5f7d750344b3 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Fri, 3 Apr 2020 13:13:02 +0200 Subject: [PATCH] [ML] call job validation endpoint with complete payload (#62331) (#62404) --- .../application/services/ml_api_service/index.ts | 11 +++++++++-- .../job_validation/validate_model_memory_limit.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts index 3be8679830423..e160126833801 100644 --- a/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts +++ b/x-pack/plugins/ml/public/application/services/ml_api_service/index.ts @@ -151,8 +151,15 @@ export const ml = { }); }, - validateJob({ job }: { job: Job }) { - const body = JSON.stringify({ job }); + validateJob(payload: { + job: Job; + duration: { + start?: number; + end?: number; + }; + fields?: any[]; + }) { + const body = JSON.stringify(payload); return http({ path: `${basePath()}/validate/job`, method: 'POST', diff --git a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts index 0c431f6a07563..16a48addfeaf4 100644 --- a/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts +++ b/x-pack/plugins/ml/server/models/job_validation/validate_model_memory_limit.ts @@ -46,7 +46,7 @@ export async function validateModelMemoryLimit( // if there is no duration, do not run the estimate test const runCalcModelMemoryTest = - duration && typeof duration?.start !== undefined && duration?.end !== undefined; + duration && duration?.start !== undefined && duration?.end !== undefined; // retrieve the max_model_memory_limit value from the server // this will be unset unless the user has set this on their cluster