List of usage examples for org.apache.hadoop.yarn.client.api YarnClient getConfig
@Override
public Configuration getConfig()
From source file:io.hops.hopsworks.common.jobs.flink.YarnClusterClient.java
License:Apache License
/** * Create a new Flink on YARN cluster./* ww w . j a v a2s.c om*/ * * @param clusterDescriptor The descriptor used at cluster creation * @param yarnClient Client to talk to YARN * @param appReport the YARN application ID * @param flinkConfig Flink configuration * @param sessionFilesDir Location of files required for YARN session * @param newlyCreatedCluster Indicator whether this cluster has just been * created * @throws IOException * @throws YarnException */ public YarnClusterClient(final AbstractYarnClusterDescriptor clusterDescriptor, final YarnClient yarnClient, final ApplicationReport appReport, org.apache.flink.configuration.Configuration flinkConfig, Path sessionFilesDir, boolean newlyCreatedCluster) throws IOException, YarnException { super(flinkConfig); this.akkaDuration = AkkaUtils.getTimeout(flinkConfig); this.clusterDescriptor = clusterDescriptor; this.yarnClient = yarnClient; this.hadoopConfig = yarnClient.getConfig(); this.sessionFilesDir = sessionFilesDir; this.appReport = appReport; this.appId = appReport.getApplicationId(); this.trackingURL = appReport.getTrackingUrl(); this.newlyCreatedCluster = newlyCreatedCluster; this.applicationClient = new LazApplicationClientLoader(flinkConfig, actorSystemLoader); this.pollingRunner = new PollingThread(yarnClient, appId); this.pollingRunner.setDaemon(true); this.pollingRunner.start(); Runtime.getRuntime().addShutdownHook(clientShutdownHook); }
From source file:org.apache.slider.core.launch.CredentialUtils.java
License:Apache License
/** * Create and add an RM delegation token to the credentials * @param yarnClient Yarn Client//from www .ja va 2s . c o m * @param credentials to add token to * @return the token which was added * @throws IOException * @throws YarnException */ public static Token<TokenIdentifier> addRMDelegationToken(YarnClient yarnClient, Credentials credentials) throws IOException, YarnException { Configuration conf = yarnClient.getConfig(); Text rmPrincipal = new Text(CredentialUtils.getRMPrincipal(conf)); Text rmDTService = ClientRMProxy.getRMDelegationTokenService(conf); Token<TokenIdentifier> rmDelegationToken = ConverterUtils .convertFromYarn(yarnClient.getRMDelegationToken(rmPrincipal), rmDTService); credentials.addToken(rmDelegationToken.getService(), rmDelegationToken); return rmDelegationToken; }