Skip to content

Commit

Permalink
initiliaze yarn clients in yarn app launcher so that a child class ca…
Browse files Browse the repository at this point in the history
…n override the yarn client creation logic
  • Loading branch information
arjun4084346 committed Apr 17, 2023
1 parent 27dea4a commit e3a3d23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public AzkabanGobblinYarnAppLauncher(String jobId, Properties gobblinProps)
gobblinConfig = gobblinConfig.withValue(GobblinYarnAppLauncher.GOBBLIN_YARN_APP_LAUNCHER_MODE,
ConfigValueFactory.fromAnyRef(GobblinYarnAppLauncher.AZKABAN_APP_LAUNCHER_MODE_KEY));
this.gobblinYarnAppLauncher = getYarnAppLauncher(gobblinConfig);
this.gobblinYarnAppLauncher.initializeYarnClients(gobblinConfig);
}

protected GobblinYarnAppLauncher getYarnAppLauncher(Config gobblinConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@
* this count exceeds the maximum number allowed, it will initiate a shutdown.
* </p>
*
* <p>
* Users of {@link GobblinYarnAppLauncher} need to call {@link #initializeYarnClients} which a child class can override.
* </p>
*
* @author Yinan Li
*/
public class GobblinYarnAppLauncher {
Expand Down Expand Up @@ -260,7 +264,6 @@ public GobblinYarnAppLauncher(Config config, YarnConfiguration yarnConfiguration
YarnHelixUtils.setAdditionalYarnClassPath(config, this.yarnConfiguration);
this.yarnConfiguration.set("fs.automatic.close", "false");
this.originalYarnRMAddress = this.yarnConfiguration.get(GobblinYarnConfigurationKeys.YARN_RESOURCE_MANAGER_ADDRESS);
createPotentialYarnClients(config, this.potentialYarnClients);

this.fs = GobblinClusterUtils.buildFileSystem(config, this.yarnConfiguration);
this.closer.register(this.fs);
Expand Down Expand Up @@ -323,14 +326,14 @@ public GobblinYarnAppLauncher(Config config, YarnConfiguration yarnConfiguration
}
}

protected void createPotentialYarnClients(Config config, Map<String, YarnClient> potentialYarnClients) {
public void initializeYarnClients(Config config) {
Set<String> potentialRMAddresses = new HashSet<>(ConfigUtils.getStringList(config, GobblinYarnConfigurationKeys.OTHER_YARN_RESOURCE_MANAGER_ADDRESSES));
potentialRMAddresses.add(originalYarnRMAddress);
for (String rmAddress : potentialRMAddresses) {
YarnClient tmpYarnClient = YarnClient.createYarnClient();
this.yarnConfiguration.set(GobblinYarnConfigurationKeys.YARN_RESOURCE_MANAGER_ADDRESS, rmAddress);
tmpYarnClient.init(new YarnConfiguration(this.yarnConfiguration));
potentialYarnClients.put(rmAddress, tmpYarnClient);
this.potentialYarnClients.put(rmAddress, tmpYarnClient);
}
}

Expand Down

0 comments on commit e3a3d23

Please sign in to comment.