From 0d83978c28ea6bf81eacfe7caedc5976d48a6137 Mon Sep 17 00:00:00 2001 From: Chengmin Chi Date: Thu, 27 Sep 2018 15:58:15 +0800 Subject: [PATCH] fix datastore for multiple final result --- src/nni_manager/core/nniDataStore.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/nni_manager/core/nniDataStore.ts b/src/nni_manager/core/nniDataStore.ts index 47c2f01dc3..790a5680c0 100644 --- a/src/nni_manager/core/nniDataStore.ts +++ b/src/nni_manager/core/nniDataStore.ts @@ -160,12 +160,11 @@ class NNIDataStore implements DataStore { private async getFinalMetricData(trialJobId: string): Promise { const metrics: MetricDataRecord[] = await this.getMetricData(trialJobId, 'FINAL'); - assert(metrics.length <= 1); - if (metrics.length === 1) { - return metrics[0]; - } else { - return undefined; + if (metrics.length > 1) { + this.log.error(`Found multiple final results for trial job: ${trialJobId}`); } + + return metrics[0]; } private getJobStatusByLatestEvent(event: TrialJobEvent): TrialJobStatus {