From dd997c4d27d39070e1acc612ea3cb4ab8d0bd48d Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 2 Apr 2020 17:11:04 +0200 Subject: [PATCH] [ML] call job validation endpoint with complete payload --- .../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