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

Fix broken issue comes from OpenPAI API upgrade #227

Merged
merged 16 commits into from
Oct 17, 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/training_service/pai/paiData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ export const PAI_OUTPUT_DIR_FORMAT: string =
`hdfs://{0}:9000/`;

export const PAI_LOG_PATH_FORMAT: string =
`http://{0}:50070/explorer.html#{1}`
`http://{0}/webhdfs/explorer.html#{1}`
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class PAIJobInfoCollector {
// Rest call to get PAI job info and update status
// Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const getJobInfoRequest: request.Options = {
uri: `http://${paiClusterConfig.host}:9186/api/v1/jobs/${paiTrialJob.paiJobName}`,
uri: `http://${paiClusterConfig.host}/rest-server/api/v1/user/${paiClusterConfig.userName}/jobs/${paiTrialJob.paiJobName}`,
method: 'GET',
json: true,
headers: {
Expand Down
27 changes: 17 additions & 10 deletions src/nni_manager/training_service/pai/paiTrainingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class PAITrainingService implements TrainingService {
// Step 3. Submit PAI job via Rest call
// Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const submitJobRequest: request.Options = {
uri: `http://${this.paiClusterConfig.host}:9186/api/v1/jobs`,
uri: `http://${this.paiClusterConfig.host}/rest-server/api/v1/user/${this.paiClusterConfig.userName}/jobs`,
method: 'POST',
json: true,
body: paiJobConfig,
Expand Down Expand Up @@ -291,7 +291,7 @@ class PAITrainingService implements TrainingService {
}

const stopJobRequest: request.Options = {
uri: `http://${this.paiClusterConfig.host}:9186/api/v1/jobs/${trialJobDetail.paiJobName}/executionType`,
uri: `http://${this.paiClusterConfig.host}/rest-server/api/v1/user/${this.paiClusterConfig.userName}/jobs/${trialJobDetail.paiJobName}/executionType`,
method: 'PUT',
json: true,
body: {'value' : 'STOP'},
Expand Down Expand Up @@ -322,13 +322,15 @@ class PAITrainingService implements TrainingService {

this.hdfsClient = WebHDFS.createClient({
user: this.paiClusterConfig.userName,
port: 50070,
// Refer PAI document for Pylon mapping https://github.com/Microsoft/pai/tree/master/docs/pylon
port: 80,
path: '/webhdfs/webhdfs/v1',
host: this.paiClusterConfig.host
});

// Get PAI authentication token
const authentication_req: request.Options = {
uri: `http://${this.paiClusterConfig.host}:9186/api/v1/token`,
uri: `http://${this.paiClusterConfig.host}/rest-server/api/v1/token`,
method: 'POST',
json: true,
body: {
Expand Down Expand Up @@ -393,14 +395,19 @@ class PAITrainingService implements TrainingService {
this.hdfsBaseDir = "/";
}

const hdfsClient = WebHDFS.createClient({
user: this.paiClusterConfig.userName,
port: 50070,
host: this.hdfsOutputHost
});
let dataOutputHdfsClient;
if (this.paiClusterConfig.host === this.hdfsOutputHost && this.hdfsClient) {
dataOutputHdfsClient = this.hdfsClient
} else {
dataOutputHdfsClient = WebHDFS.createClient({
user: this.paiClusterConfig.userName,
port: 50070,
host: this.hdfsOutputHost
});
}

try {
const exist : boolean = await HDFSClientUtility.pathExists("/", hdfsClient);
const exist : boolean = await HDFSClientUtility.pathExists("/", dataOutputHdfsClient);
if(!exist) {
deferred.reject(new Error(`Please check hdfsOutputDir host!`));
}
Expand Down