Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Fix issue #124: Rest service api/v1/nni/metric-data can not retrieve metric data for multiple trial jobs #188

Merged
merged 4 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nni_manager/common/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class DataStore {
public abstract listTrialJobs(status?: TrialJobStatus): Promise<TrialJobInfo[]>;
public abstract getTrialJob(trialJobId: string): Promise<TrialJobInfo>;
public abstract storeMetricData(trialJobId: string, data: string): Promise<void>;
public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]>;
public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]>;
}

abstract class Database {
Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/common/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract class Manager {
public abstract setClusterMetadata(key: string, value: string): Promise<void>;
public abstract getClusterMetadata(key: string): Promise<string>;

public abstract getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]>;
public abstract getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]>;
public abstract getTrialJobStatistics(): Promise<TrialJobStatistics[]>;
public abstract getStatus(): NNIManagerStatus;
}
Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/core/nniDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class NNIDataStore implements DataStore {
}));
}

public getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]> {
public getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]> {
return this.db.queryMetricData(trialJobId, metricType);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/core/nnimanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class NNIManager implements Manager {
}
}

public async getMetricData(trialJobId: string, metricType: MetricType): Promise<MetricDataRecord[]> {
public async getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]> {
return this.dataStore.getMetricData(trialJobId, metricType);
}

Expand Down
2 changes: 1 addition & 1 deletion src/nni_manager/rest_server/restHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down