/** * Instantiate * @param roles initial role list * @param recordFactory yarn record factory * @throws BadConfigException */ public RoleHistory(Collection<RoleStatus> roles, AbstractClusterServices recordFactory) throws BadConfigException { this.recordFactory = recordFactory; roleSize = roles.size(); providerRoles = new ArrayList<>(roleSize); for (RoleStatus role : roles) { addNewRole(role); } reset(); }
rebuild(loadedRoleHistory); thawSuccessful = true; Path loadPath = loadedRoleHistory.getPath(); buildRecentNodeLists(); } else { onBootstrap();
/** * Cancel any outstanding AA Requests, building up the list of ops to * cancel, removing them from RoleHistory structures and the RoleStatus * entries. * @return a (usually empty) list of cancel/request operations. */ public synchronized List<AbstractRMOperation> cancelOutstandingAARequests() { // get the list of cancel operations List<AbstractRMOperation> operations = roleHistory.cancelOutstandingAARequests(); for (RoleStatus roleStatus : roleStatusMap.values()) { if (roleStatus.isAARequestOutstanding()) { log.info("Cancelling outstanding AA request for {}", roleStatus); roleStatus.cancelOutstandingAARequest(); } } return operations; }
/** * Cancel a number of outstanding requests for a role -that is, not * actual containers, just requests for new ones. * @param role role * @param toCancel number to cancel * @return a list of cancellable operations. */ public List<AbstractRMOperation> cancelRequestsForRole(RoleStatus role, int toCancel) { return role.isAntiAffinePlacement() ? cancelRequestsForAARole(role, toCancel) : cancelRequestsForSimpleRole(role, toCancel); }
roleHistory = new RoleHistory(roleStatusMap.values(), recordFactory); roleHistory.register(metricsAndMonitoring); roleHistory.onStart(binding.fs, binding.historyPath); roleHistory.onNodesUpdated(binding.nodeReports);
int roles = history.getRoleSize(); Schema schema = record.getSchema(); Encoder encoder = EncoderFactory.get().jsonEncoder(schema, out); long count = 0; Collection<NodeInstance> instances = history.cloneNodemap().values(); for (NodeInstance instance : instances) { for (int role = 0; role < roles; role++) {
if (roleHistory.canPlaceAANodes()) { List<AbstractRMOperation> cancellations = roleHistory.cancelRequestsForRole(role, toCancel); log.info("Found {} outstanding requests to cancel", cancellations.size()); operations.addAll(cancellations);
/** * Create the rolemap record * @param history history * @return a record to insert into the file */ private RoleHistoryRecord createRolemapRecord(RoleHistory history) { RoleHistoryMapping entry = new RoleHistoryMapping(); Map<CharSequence, Integer> mapping = history.buildMappingForHistoryFile(); entry.setRolemap(mapping); return new RoleHistoryRecord(entry); }
log.info("New role {}", roleStatus); if (roleHistory != null) { roleHistory.addNewRole(roleStatus); log.info("New role {}", roleStatus); if (roleHistory != null) { roleHistory.addNewRole(roleStatus);
roleHistory = new RoleHistory(roleStatusMap.values(), recordFactory); roleHistory.register(metricsAndMonitoring); roleHistory.onStart(binding.fs, binding.historyPath); roleHistory.onNodesUpdated(binding.nodeReports);
/** * Cancel a number of outstanding requests for a role -that is, not * actual containers, just requests for new ones. * @param role role * @param toCancel number to cancel * @return a list of cancellable operations. */ public List<AbstractRMOperation> cancelRequestsForRole(RoleStatus role, int toCancel) { return role.isAntiAffinePlacement() ? cancelRequestsForAARole(role, toCancel) : cancelRequestsForSimpleRole(role, toCancel); }
int roles = history.getRoleSize(); Schema schema = record.getSchema(); Encoder encoder = EncoderFactory.get().jsonEncoder(schema, out); long count = 0; Collection<NodeInstance> instances = history.cloneNodemap().values(); for (NodeInstance instance : instances) { for (int role = 0; role < roles; role++) {
if (roleHistory.canPlaceAANodes()) { List<AbstractRMOperation> cancellations = roleHistory.cancelRequestsForRole(role, toCancel); log.info("Found {} outstanding requests to cancel", cancellations.size()); operations.addAll(cancellations);
/** * Create the rolemap record * @param history history * @return a record to insert into the file */ private RoleHistoryRecord createRolemapRecord(RoleHistory history) { RoleHistoryMapping entry = new RoleHistoryMapping(); Map<CharSequence, Integer> mapping = history.buildMappingForHistoryFile(); entry.setRolemap(mapping); return new RoleHistoryRecord(entry); }
log.info("New role {}", roleStatus); if (roleHistory != null) { roleHistory.addNewRole(roleStatus); log.info("New role {}", roleStatus); if (roleHistory != null) { roleHistory.addNewRole(roleStatus);
rebuild(loadedRoleHistory); thawSuccessful = true; Path loadPath = loadedRoleHistory.getPath(); buildRecentNodeLists(); } else { onBootstrap();
/** * Instantiate * @param roles initial role list * @param recordFactory yarn record factory * @throws BadConfigException */ public RoleHistory(Collection<RoleStatus> roles, AbstractClusterServices recordFactory) throws BadConfigException { this.recordFactory = recordFactory; roleSize = roles.size(); providerRoles = new ArrayList<>(roleSize); for (RoleStatus role : roles) { addNewRole(role); } reset(); }
/** * Cancel any outstanding AA Requests, building up the list of ops to * cancel, removing them from RoleHistory structures and the RoleStatus * entries. * @return a (usually empty) list of cancel/request operations. */ public synchronized List<AbstractRMOperation> cancelOutstandingAARequests() { // get the list of cancel operations List<AbstractRMOperation> operations = roleHistory.cancelOutstandingAARequests(); for (RoleStatus roleStatus : roleStatusMap.values()) { if (roleStatus.isAARequestOutstanding()) { log.info("Cancelling outstanding AA request for {}", roleStatus); roleStatus.cancelOutstandingAARequest(); } } return operations; }