List of usage examples for org.apache.hadoop.yarn.conf YarnConfiguration RM_AM_EXPIRY_INTERVAL_MS
String RM_AM_EXPIRY_INTERVAL_MS
To view the source code for org.apache.hadoop.yarn.conf YarnConfiguration RM_AM_EXPIRY_INTERVAL_MS.
Click Source Link
From source file:edu.uci.ics.hyracks.yarn.am.HyracksYarnApplicationMaster.java
License:Apache License
private void setupHeartbeats() { long heartbeatInterval = config.getLong(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); System.err.println("Heartbeat interval: " + heartbeatInterval); heartbeatInterval = Math.min(heartbeatInterval, 1000); System.err.println("Heartbeat interval: " + heartbeatInterval); timer.schedule(new TimerTask() { @Override/* www. ja v a 2s.c om*/ public void run() { AllocateRequest hb = Records.newRecord(AllocateRequest.class); populateAllocateRequest(hb); hb.setApplicationAttemptId(amrmc.getApplicationAttemptId()); hb.setProgress(0); try { AllocateResponse allocateResponse = amrmc.getAMRMProtocol().allocate(hb); List<Container> allocatedContainers = allocateResponse.getAMResponse().getAllocatedContainers(); List<ContainerStatus> completedContainers = allocateResponse.getAMResponse() .getCompletedContainersStatuses(); processAllocation(allocatedContainers, completedContainers); } catch (YarnRemoteException e) { e.printStackTrace(); } } }, 0, heartbeatInterval); }
From source file:org.apache.flink.yarn.YarnFlinkResourceManager.java
License:Apache License
/** * Creates the props needed to instantiate this actor. * //from w w w. j a v a2 s.co m * Rather than extracting and validating parameters in the constructor, this factory method takes * care of that. That way, errors occur synchronously, and are not swallowed simply in a * failed asynchronous attempt to start the actor. * @param actorClass * The actor class, to allow overriding this actor with subclasses for testing. * @param flinkConfig * The Flink configuration object. * @param yarnConfig * The YARN configuration object. * @param applicationMasterHostName * The hostname where this application master actor runs. * @param webFrontendURL * The URL of the tracking web frontend. * @param taskManagerParameters * The parameters for launching TaskManager containers. * @param taskManagerLaunchContext * The parameters for launching the TaskManager processes in the TaskManager containers. * @param numInitialTaskManagers * The initial number of TaskManagers to allocate. * @param log * The logger to log to. * * @return The Props object to instantiate the YarnFlinkResourceManager actor. */ public static Props createActorProps(Class<? extends YarnFlinkResourceManager> actorClass, Configuration flinkConfig, YarnConfiguration yarnConfig, LeaderRetrievalService leaderRetrievalService, String applicationMasterHostName, String webFrontendURL, ContaineredTaskManagerParameters taskManagerParameters, ContainerLaunchContext taskManagerLaunchContext, int numInitialTaskManagers, Logger log) { final int yarnHeartbeatIntervalMS = flinkConfig.getInteger(ConfigConstants.YARN_HEARTBEAT_DELAY_SECONDS, DEFAULT_YARN_HEARTBEAT_INTERVAL_MS / 1000) * 1000; final long yarnExpiryIntervalMS = yarnConfig.getLong(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); if (yarnHeartbeatIntervalMS >= yarnExpiryIntervalMS) { log.warn( "The heartbeat interval of the Flink Application master ({}) is greater " + "than YARN's expiry interval ({}). The application is likely to be killed by YARN.", yarnHeartbeatIntervalMS, yarnExpiryIntervalMS); } final int maxFailedContainers = flinkConfig.getInteger(ConfigConstants.YARN_MAX_FAILED_CONTAINERS, numInitialTaskManagers); if (maxFailedContainers >= 0) { log.info("YARN application tolerates {} failed TaskManager containers before giving up", maxFailedContainers); } return Props.create(actorClass, flinkConfig, yarnConfig, leaderRetrievalService, applicationMasterHostName, webFrontendURL, taskManagerParameters, taskManagerLaunchContext, yarnHeartbeatIntervalMS, maxFailedContainers, numInitialTaskManagers); }
From source file:org.apache.flink.yarn.YarnResourceManager.java
License:Apache License
public YarnResourceManager(Configuration flinkConfig, Map<String, String> env, RpcService rpcService, ResourceManagerConfiguration resourceManagerConfiguration, HighAvailabilityServices highAvailabilityServices, SlotManagerFactory slotManagerFactory, MetricRegistry metricRegistry, JobLeaderIdService jobLeaderIdService, FatalErrorHandler fatalErrorHandler) { super(rpcService, resourceManagerConfiguration, highAvailabilityServices, slotManagerFactory, metricRegistry, jobLeaderIdService, fatalErrorHandler); this.flinkConfig = flinkConfig; this.yarnConfig = new YarnConfiguration(); this.ENV = env; final int yarnHeartbeatIntervalMS = flinkConfig.getInteger(ConfigConstants.YARN_HEARTBEAT_DELAY_SECONDS, DEFAULT_YARN_HEARTBEAT_INTERVAL_MS / 1000) * 1000; final long yarnExpiryIntervalMS = yarnConfig.getLong(YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS, YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS); if (yarnHeartbeatIntervalMS >= yarnExpiryIntervalMS) { log.warn(/* w ww. ja va 2 s .c om*/ "The heartbeat interval of the Flink Application master ({}) is greater " + "than YARN's expiry interval ({}). The application is likely to be killed by YARN.", yarnHeartbeatIntervalMS, yarnExpiryIntervalMS); } yarnHeartbeatIntervalMillis = yarnHeartbeatIntervalMS; numPendingContainerRequests = 0; }