Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
解决yarn webui开启Kerberos认证后递交Flink任务无法获取任务状态的问题,增加调用Flink HTTP API时候进行Kerberos认证,相关issues: DataLinkDC#3470
  • Loading branch information
ze.miao committed Dec 9, 2024
1 parent 7ee84fe commit ee88e74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import java.io.IOException;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RequestKerberosUrlUtils {
public static Logger logger = LoggerFactory.getLogger(RequestKerberosUrlUtils.class);
private String principal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ protected String getWebUrl(ClusterClient<ApplicationId> clusterClient, YarnResul
String webUrl;
int counts = SystemConfiguration.getInstances().GetJobIdWaitValue();
while (yarnClient.getApplicationReport(clusterClient.getClusterId()).getYarnApplicationState()
== YarnApplicationState.ACCEPTED
== YarnApplicationState.ACCEPTED
&& counts-- > 0) {
Thread.sleep(1000);
}
Expand All @@ -403,8 +403,8 @@ protected String getWebUrl(ClusterClient<ApplicationId> clusterClient, YarnResul
// 睡眠1秒,防止flink因为依赖或其他问题导致任务秒挂
Thread.sleep(1000);
String url = yarnClient
.getApplicationReport(clusterClient.getClusterId())
.getTrackingUrl()
.getApplicationReport(clusterClient.getClusterId())
.getTrackingUrl()
+ JobsOverviewHeaders.URL.substring(1);

String json = HttpUtil.get(url);
Expand Down Expand Up @@ -470,8 +470,8 @@ protected String getYarnContainerLog(ApplicationReport applicationReport) throws
// Wait for up to 2.5 s. If the history log is not found yet, a prompt message will be returned.
int counts = 5;
while (yarnClient
.getContainers(applicationReport.getCurrentApplicationAttemptId())
.isEmpty()
.getContainers(applicationReport.getCurrentApplicationAttemptId())
.isEmpty()
&& counts-- > 0) {
ThreadUtil.sleep(500);
}
Expand Down

0 comments on commit ee88e74

Please sign in to comment.