public Token<AMRMTokenIdentifier> getAMRMToken() throws YarnClientException { try { return yarnClient.getAMRMToken(appId); } catch (YarnException | IOException e) { throw new YarnClientException("Get AM/RM token failed", e); } }
private Token<AMRMTokenIdentifier> _initYarnApp(String queue) throws Exception { appId = _createApp(yarnClient, queue); _monitorAppState(yarnClient, appId, ACCEPTED, false); LOG.debug("Created Application, AM '{}' for '{}' queue", appId, queue); Token<AMRMTokenIdentifier> token = yarnClient.getAMRMToken(appId); int counter = 0; while (token == null && counter < 10) { Clock.sleep(200); token = yarnClient.getAMRMToken(appId); counter++; } if (token == null) { throw new LlamaException(ErrorCode.AM_AMRM_TOKEN_CANNOT_BE_FETCHED, queue); } return token; }
void submit() throws IOException, YarnException { LOG.log(Level.INFO, "Submitting REEF Application with UNMANAGED AM to YARN. ID: {0}", this.applicationId); this.yarnClient.submitApplication(this.applicationSubmissionContext); final Token<AMRMTokenIdentifier> token = this.yarnClient.getAMRMToken(this.applicationId); this.yarnProxyUser.set("reef-uam-proxy", UserGroupInformation.getCurrentUser(), token); this.tokenProvider.addTokens(UserCredentialSecurityTokenProvider.serializeToken(token)); }
Credentials credentials = new Credentials(); Token<AMRMTokenIdentifier> token = rmClient.getAMRMToken(attemptId.getApplicationId());
public void submit() throws IOException, YarnException { // SET EXEC COMMAND final List<String> launchCommand = new JavaLaunchCommandBuilder(launcherClazz, commandPrefixList) .setConfigurationFilePaths(configurationFilePaths) .setClassPath(this.classpath.getDriverClasspath()) .setMemory(this.applicationSubmissionContext.getResource().getMemory()) .setStandardOut(driverStdoutFilePath) .setStandardErr(driverStderrFilePath) .build(); if (this.applicationSubmissionContext.getKeepContainersAcrossApplicationAttempts() && this.applicationSubmissionContext.getMaxAppAttempts() == 1) { LOG.log(Level.WARNING, "Application will not be restarted even though preserve evaluators is set to true" + " since the max application submissions is 1. Proceeding to submit application..."); } final ContainerLaunchContext containerLaunchContext = YarnTypes.getContainerLaunchContext( launchCommand, this.resources, tokenProvider.getTokens()); this.applicationSubmissionContext.setAMContainerSpec(containerLaunchContext); LOG.log(Level.INFO, "Submitting REEF Application to YARN. ID: {0}", this.applicationId); if (LOG.isLoggable(Level.INFO)) { LOG.log(Level.INFO, "REEF app command: {0}", StringUtils.join(launchCommand, ' ')); } this.yarnClient.submitApplication(applicationSubmissionContext); if (this.isUnmanaged) { // For Unmanaged AM mode, add a new app token to the // current process so it can talk to the RM as an AM. final Token<AMRMTokenIdentifier> token = this.yarnClient.getAMRMToken(this.applicationId); this.yarnProxyUser.set("reef-proxy", UserGroupInformation.getCurrentUser(), token); this.tokenProvider.addTokens(UserCredentialSecurityTokenProvider.serializeToken(token)); } }