Unverified Commit 42d8cbda authored by fishyds's avatar fishyds Committed by GitHub
Browse files

Fix broken issue comes from OpenPAI API upgrade (#227)

Fix paiTrainingService broken issue comes from OpenPAI API upgrade 
parent deaa1873
......@@ -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}`
......@@ -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: {
......
......@@ -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,
......@@ -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'},
......@@ -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: {
......@@ -393,14 +395,19 @@ class PAITrainingService implements TrainingService {
this.hdfsBaseDir = "/";
}
const hdfsClient = WebHDFS.createClient({
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!`));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment