Skip to content

Commit

Permalink
Merge pull request #21 from hynix/master
Browse files Browse the repository at this point in the history
bug fix: use yarn address
  • Loading branch information
hynix authored Feb 3, 2022
2 parents 5c89c1a + a2e6df0 commit d0bbc80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.exacaster.lighter.backend.yarn;

import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_ADDRESS;
import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_KEYTAB;
import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_PRINCIPAL;
import static org.apache.hadoop.yarn.conf.YarnConfiguration.RM_WEBAPP_ADDRESS;

import com.exacaster.lighter.configuration.AppConfiguration;
import io.micronaut.context.annotation.Factory;
Expand All @@ -18,7 +18,9 @@ public class YarnConfigurationFactory {
@Singleton
public YarnBackend backend(YarnProperties yarnProperties, AppConfiguration conf) {
YarnConfiguration yarnConfiguration = new YarnConfiguration();
yarnConfiguration.set(RM_WEBAPP_ADDRESS, yarnProperties.getUrl());
if (yarnProperties.getAddress() != null) {
yarnConfiguration.set(RM_ADDRESS, yarnProperties.getAddress());
}
if (yarnProperties.getKerberosKeytab() != null && yarnProperties.getKerberosPrincipal() != null) {
yarnConfiguration.set(RM_PRINCIPAL, yarnProperties.getKerberosPrincipal());
yarnConfiguration.set(RM_KEYTAB, yarnProperties.getKerberosKeytab());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ public class YarnProperties {

private final String kerberosPrincipal;
private final String kerberosKeytab;
private final String url;
private final String address;

@ConfigurationInject
public YarnProperties(@Nullable String kerberosPrincipal, @Nullable String kerberosKeytab, String url) {
public YarnProperties(@Nullable String kerberosPrincipal, @Nullable String kerberosKeytab,
@Nullable String address) {
this.kerberosPrincipal = kerberosPrincipal;
this.kerberosKeytab = kerberosKeytab;
this.url = url;
this.address = address;
}

public String getKerberosPrincipal() {
Expand All @@ -29,16 +30,16 @@ public String getKerberosKeytab() {
return kerberosKeytab;
}

public String getUrl() {
return url;
public String getAddress() {
return address;
}

@Override
public String toString() {
return new StringJoiner(", ", YarnProperties.class.getSimpleName() + "[", "]")
.add("kerberosPrincipal='" + kerberosPrincipal + "'")
.add("kerberosKeytab='" + kerberosKeytab + "'")
.add("url='" + url + "'")
.add("address='" + address + "'")
.toString();
}
}

0 comments on commit d0bbc80

Please sign in to comment.