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

Commit

Permalink
Fix broken issue comes from OpenPAI API upgrade (#227)
Browse files Browse the repository at this point in the history
Fix paiTrainingService broken issue comes from OpenPAI API upgrade
  • Loading branch information
yds05 authored Oct 17, 2018
1 parent deaa187 commit 42d8cbd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
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

0 comments on commit 42d8cbd

Please sign in to comment.