From 93dae28f964b9f570d8502d9fe4d257acc56a085 Mon Sep 17 00:00:00 2001 From: chicm-ms <38930155+chicm-ms@users.noreply.github.com> Date: Thu, 11 Oct 2018 10:37:16 +0800 Subject: [PATCH] Fix issue #124: Rest service api/v1/nni/metric-data can not retrieve metric data for multiple trial jobs (#188) * Pull latest code (#2) * webui logpath and document (#135) * Add webui document and logpath as a href * fix tslint * fix comments by Chengmin * Pai training service bug fix and enhancement (#136) * Add NNI installation scripts * Update pai script, update NNI_out_dir * Update NNI dir in nni sdk local.py * Create .nni folder in nni sdk local.py * Add check before creating .nni folder * Fix typo for PAI_INSTALL_NNI_SHELL_FORMAT * Improve annotation (#138) * Improve annotation * Minor bugfix * Selectively install through pip (#139) Selectively install through pip * update setup.py * fix paiTrainingService bugs (#137) * fix nnictl bug * add hdfs host validation * fix bugs * fix dockerfile * fix install.sh * update install.sh * fix dockerfile * Set timeout for HDFSUtility exists function * remove unused TODO * fix sdk * add optional for outputDir and dataDir * refactor dockerfile.base * Remove unused import in hdfsclientUtility * Add documentation for NNI PAI mode experiment (#141) * Add documentation for NNI PAI mode * Fix typo based on PR comments * Exit with subprocess return code of trial keeper * Remove additional exit code * Fix typo based on PR comments * update doc for smac tuner (#140) * Revert "Selectively install through pip (#139)" due to potential pip install issue (#142) * Revert "Selectively install through pip (#139)" This reverts commit 1d174836d3146a0363e9c9c88094bf9cff865faa. * Add exit code of subprocess for trial_keeper * Update README, add link to PAImode doc * fix bug (#147) * Refactor nnictl and add config_pai.yml (#144) * fix nnictl bug * add hdfs host validation * fix bugs * fix dockerfile * fix install.sh * update install.sh * fix dockerfile * Set timeout for HDFSUtility exists function * remove unused TODO * fix sdk * add optional for outputDir and dataDir * refactor dockerfile.base * Remove unused import in hdfsclientUtility * add config_pai.yml * refactor nnictl create logic and add colorful print * fix nnictl stop logic * add annotation for config_pai.yml * add document for start experiment * fix config.yml * fix document * Fix trial keeper wrongly exit issue (#152) * Fix trial keeper bug, use actual exitcode to exit rather than 1 * Fix bug of table sort (#145) * Update doc for PAIMode and v0.2 release notes (#153) * Update v0.2 documentation regards to release note and PAI training service * Update document to describe NNI docker image * Bug fix for SQuAD example tuner. (#134) * Update Makefile (#151) * test * update setup.py * update Makefile and install.sh * rever setup.py * change color * update doc * update doc * fix auto-completion's extra space * update Makefile * update webui * Update doc image (#163) * update doc * trivial * trivial * trivial * trivial * trivial * trivial * update image * update image size * Update ga squad (#104) * update readme in ga_squad * update readme * fix typo * Update README.md * Update README.md * Update README.md * update readme * sklearn examples (#169) * fix nnictl bug * fix install.sh * add sklearn-regression example * add sklearn classification * update sklearn * update example * remove additional code * Update batch tuner (#158) * update readme in ga_squad * update readme * fix typo * Update README.md * Update README.md * Update README.md * update readme * update batch tuner * Quickly fix cascading search space bug in tuner (#156) * update readme in ga_squad * update readme * fix typo * Update README.md * Update README.md * Update README.md * update readme * quickly fix cascading searchspace bug in tuner * Add iterative search space example (#119) * update readme in ga_squad * update readme * fix typo * Update README.md * Update README.md * Update README.md * update readme * add iterative search space example * update * update readme * change name * getMetricData supports multiple trial jobs --- src/nni_manager/common/datastore.ts | 2 +- src/nni_manager/common/manager.ts | 2 +- src/nni_manager/core/nniDataStore.ts | 2 +- src/nni_manager/core/nnimanager.ts | 2 +- src/nni_manager/rest_server/restHandler.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nni_manager/common/datastore.ts b/src/nni_manager/common/datastore.ts index d3cca0479b..43b0532020 100644 --- a/src/nni_manager/common/datastore.ts +++ b/src/nni_manager/common/datastore.ts @@ -78,7 +78,7 @@ abstract class DataStore { public abstract listTrialJobs(status?: TrialJobStatus): Promise; public abstract getTrialJob(trialJobId: string): Promise; public abstract storeMetricData(trialJobId: string, data: string): Promise; - public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise; + public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise; } abstract class Database { diff --git a/src/nni_manager/common/manager.ts b/src/nni_manager/common/manager.ts index 4deac47387..a00cb88f34 100644 --- a/src/nni_manager/common/manager.ts +++ b/src/nni_manager/common/manager.ts @@ -92,7 +92,7 @@ abstract class Manager { public abstract setClusterMetadata(key: string, value: string): Promise; public abstract getClusterMetadata(key: string): Promise; - public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise; + public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise; public abstract getTrialJobStatistics(): Promise; public abstract getStatus(): NNIManagerStatus; } diff --git a/src/nni_manager/core/nniDataStore.ts b/src/nni_manager/core/nniDataStore.ts index 81afeb3af3..c112340f64 100644 --- a/src/nni_manager/core/nniDataStore.ts +++ b/src/nni_manager/core/nniDataStore.ts @@ -138,7 +138,7 @@ class NNIDataStore implements DataStore { })); } - public getMetricData(trialJobId: string, metricType: MetricType): Promise { + public getMetricData(trialJobId?: string, metricType?: MetricType): Promise { return this.db.queryMetricData(trialJobId, metricType); } diff --git a/src/nni_manager/core/nnimanager.ts b/src/nni_manager/core/nnimanager.ts index 23364d5448..09b1f2310c 100644 --- a/src/nni_manager/core/nnimanager.ts +++ b/src/nni_manager/core/nnimanager.ts @@ -204,7 +204,7 @@ class NNIManager implements Manager { } } - public async getMetricData(trialJobId: string, metricType: MetricType): Promise { + public async getMetricData(trialJobId?: string, metricType?: MetricType): Promise { return this.dataStore.getMetricData(trialJobId, metricType); } diff --git a/src/nni_manager/rest_server/restHandler.ts b/src/nni_manager/rest_server/restHandler.ts index 89ede1d51f..cd90e149ff 100644 --- a/src/nni_manager/rest_server/restHandler.ts +++ b/src/nni_manager/rest_server/restHandler.ts @@ -245,7 +245,7 @@ class NNIRestHandler { } private getMetricData(router: Router): void { - router.get('/metric-data/:job_id', async (req: Request, res: Response) => { + router.get('/metric-data/:job_id*?', async (req: Request, res: Response) => { this.nniManager.getMetricData(req.params.job_id, req.query.type).then((metricsData: MetricDataRecord[]) => { res.send(metricsData); }).catch((err: Error) => {