@ -195,7 +195,7 @@ public class HadoopUtils implements Closeable {
* /
* /
String appUrl = "" ;
String appUrl = "" ;
if ( StringUtils . isEmpty ( rmHaIds ) ) {
if ( StringUtils . isEmpty ( rmHaIds ) ) {
//single resourcemanager enabled
//single resourcemanager enabled
appUrl = appAddress ;
appUrl = appAddress ;
yarnEnabled = true ;
yarnEnabled = true ;
@ -206,7 +206,7 @@ public class HadoopUtils implements Closeable {
logger . info ( "application url : {}" , appUrl ) ;
logger . info ( "application url : {}" , appUrl ) ;
}
}
if ( StringUtils . isBlank ( appUrl ) ) {
if ( StringUtils . isBlank ( appUrl ) ) {
throw new Exception ( "application url is blank" ) ;
throw new Exception ( "application url is blank" ) ;
}
}
return String . format ( appUrl , applicationId ) ;
return String . format ( appUrl , applicationId ) ;
@ -417,25 +417,33 @@ public class HadoopUtils implements Closeable {
String applicationUrl = getApplicationUrl ( applicationId ) ;
String applicationUrl = getApplicationUrl ( applicationId ) ;
logger . info ( "applicationUrl={}" , applicationUrl ) ;
logger . info ( "applicationUrl={}" , applicationUrl ) ;
String responseContent ;
String responseContent ;
if ( PropertyUtils . getBoolean ( Constants . HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE , false ) ) {
if ( PropertyUtils . getBoolean ( Constants . HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE , false ) ) {
responseContent = KerberosHttpClient . get ( applicationUrl ) ;
responseContent = KerberosHttpClient . get ( applicationUrl ) ;
} else {
} else {
responseContent = HttpUtils . get ( applicationUrl ) ;
responseContent = HttpUtils . get ( applicationUrl ) ;
}
}
if ( responseContent ! = null ) {
if ( responseContent ! = null ) {
ObjectNode jsonObject = JSONUtils . parseObject ( responseContent ) ;
ObjectNode jsonObject = JSONUtils . parseObject ( responseContent ) ;
if ( ! jsonObject . has ( "app" ) ) {
return ExecutionStatus . FAILURE ;
}
result = jsonObject . path ( "app" ) . path ( "finalStatus" ) . asText ( ) ;
result = jsonObject . path ( "app" ) . path ( "finalStatus" ) . asText ( ) ;
} else {
} else {
//may be in job history
//may be in job history
String jobHistoryUrl = getJobHistoryUrl ( applicationId ) ;
String jobHistoryUrl = getJobHistoryUrl ( applicationId ) ;
logger . info ( "jobHistoryUrl={}" , jobHistoryUrl ) ;
logger . info ( "jobHistoryUrl={}" , jobHistoryUrl ) ;
responseContent = HttpUtils . get ( jobHistoryUrl ) ;
responseContent = HttpUtils . get ( jobHistoryUrl ) ;
ObjectNode jsonObject = JSONUtils . parseObject ( responseContent ) ;
if ( null ! = responseContent ) {
if ( ! jsonObject . has ( "job" ) ) {
ObjectNode jsonObject = JSONUtils . parseObject ( responseContent ) ;
if ( ! jsonObject . has ( "job" ) ) {
return ExecutionStatus . FAILURE ;
}
result = jsonObject . path ( "job" ) . path ( "state" ) . asText ( ) ;
} else {
return ExecutionStatus . FAILURE ;
return ExecutionStatus . FAILURE ;
}
}
result = jsonObject . path ( "job" ) . path ( "state" ) . asText ( ) ;
}
}
switch ( result ) {
switch ( result ) {
@ -474,7 +482,7 @@ public class HadoopUtils implements Closeable {
/ * *
/ * *
* hdfs resource dir
* hdfs resource dir
*
*
* @param tenantCode tenant code
* @param tenantCode tenant code
* @param resourceType resource type
* @param resourceType resource type
* @return hdfs resource dir
* @return hdfs resource dir
* /
* /
@ -679,7 +687,7 @@ public class HadoopUtils implements Closeable {
ObjectNode jsonObject = JSONUtils . parseObject ( retStr ) ;
ObjectNode jsonObject = JSONUtils . parseObject ( retStr ) ;
//get ResourceManager state
//get ResourceManager state
if ( ! jsonObject . has ( "clusterInfo" ) ) {
if ( ! jsonObject . has ( "clusterInfo" ) ) {
return null ;
return null ;
}
}
return jsonObject . get ( "clusterInfo" ) . path ( "haState" ) . asText ( ) ;
return jsonObject . get ( "clusterInfo" ) . path ( "haState" ) . asText ( ) ;