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

fix url and api conflict #3672

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 nni/tools/nnictl/url_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
METRIC_DATA_API = '/metric-data'

def formatURLPath(path):
return '' if path is None else '/{0}'.format(path)
return API_ROOT_URL if path is None else '{0}/{1}'.format(API_ROOT_URL, path)

def setPrefixUrl(prefix_path):
global API_ROOT_URL
Expand Down
2 changes: 1 addition & 1 deletion ts/nni_manager/common/experimentStartupInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class ExperimentStartupInfo {

public getAPIRootUrl(): string {
assert(this.initialized);
return this.urlprefix==''?this.API_ROOT_URL:`/${this.urlprefix}`;
return this.urlprefix==''?this.API_ROOT_URL:`${this.API_ROOT_URL}/${this.urlprefix}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ts/webui/src/static/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const METRIC_GROUP_UPDATE_SIZE = 20;

const prefix = getPrefix();

const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : `${prefix}`;
const MANAGER_IP = prefix === undefined ? '/api/v1/nni' : `api/v1/nni${prefix}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefix should be before /api?

Copy link
Contributor

@Lijiaoa Lijiaoa May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But when rest api is prefix/api/v1/nni, it still is conflict with ui router. because they are in the same directory prefix/xxx .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
test with ui router ip:port/api/oview and rest api ip:port/api/v1/nni/trial-jobs, webportal is normal!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @liuzhe-lz , do you have any concern?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it work first.

const DOWNLOAD_IP = `/logs`;

const WEBUIDOC = 'https://nni.readthedocs.io/en/latest/Tutorial/WebUI.html';
Expand Down