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 = ...@@ -69,4 +69,4 @@ export const PAI_OUTPUT_DIR_FORMAT: string =
`hdfs://{0}:9000/`; `hdfs://{0}:9000/`;
export const PAI_LOG_PATH_FORMAT: string = 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 { ...@@ -69,7 +69,7 @@ export class PAIJobInfoCollector {
// Rest call to get PAI job info and update status // 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 // Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const getJobInfoRequest: request.Options = { 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', method: 'GET',
json: true, json: true,
headers: { headers: {
......
...@@ -244,7 +244,7 @@ class PAITrainingService implements TrainingService { ...@@ -244,7 +244,7 @@ class PAITrainingService implements TrainingService {
// Step 3. Submit PAI job via Rest call // 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 // Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const submitJobRequest: request.Options = { 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', method: 'POST',
json: true, json: true,
body: paiJobConfig, body: paiJobConfig,
...@@ -291,7 +291,7 @@ class PAITrainingService implements TrainingService { ...@@ -291,7 +291,7 @@ class PAITrainingService implements TrainingService {
} }
const stopJobRequest: request.Options = { 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', method: 'PUT',
json: true, json: true,
body: {'value' : 'STOP'}, body: {'value' : 'STOP'},
...@@ -322,13 +322,15 @@ class PAITrainingService implements TrainingService { ...@@ -322,13 +322,15 @@ class PAITrainingService implements TrainingService {
this.hdfsClient = WebHDFS.createClient({ this.hdfsClient = WebHDFS.createClient({
user: this.paiClusterConfig.userName, 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 host: this.paiClusterConfig.host
}); });
// Get PAI authentication token // Get PAI authentication token
const authentication_req: request.Options = { 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', method: 'POST',
json: true, json: true,
body: { body: {
...@@ -393,14 +395,19 @@ class PAITrainingService implements TrainingService { ...@@ -393,14 +395,19 @@ class PAITrainingService implements TrainingService {
this.hdfsBaseDir = "/"; this.hdfsBaseDir = "/";
} }
const hdfsClient = WebHDFS.createClient({ let dataOutputHdfsClient;
user: this.paiClusterConfig.userName, if (this.paiClusterConfig.host === this.hdfsOutputHost && this.hdfsClient) {
port: 50070, dataOutputHdfsClient = this.hdfsClient
host: this.hdfsOutputHost } else {
}); dataOutputHdfsClient = WebHDFS.createClient({
user: this.paiClusterConfig.userName,
port: 50070,
host: this.hdfsOutputHost
});
}
try { try {
const exist : boolean = await HDFSClientUtility.pathExists("/", hdfsClient); const exist : boolean = await HDFSClientUtility.pathExists("/", dataOutputHdfsClient);
if(!exist) { if(!exist) {
deferred.reject(new Error(`Please check hdfsOutputDir host!`)); 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