@Override public Map<Integer, RoleStatus> getRoleStatusMap() { return appState.getRoleStatusMap(); }
@Override public Map<Integer, RoleStatus> getRoleStatusMap() { return appState.getRoleStatusMap(); }
/** * Look up the status entry of a role or raise an exception * @param key role ID * @return the status entry * @throws RuntimeException if the role cannot be found */ public RoleStatus lookupRoleStatus(int key) { RoleStatus rs = getRoleStatusMap().get(key); if (rs == null) { throw new RuntimeException("Cannot find role for role ID " + key); } return rs; }
/** * Look up the status entry of a role or raise an exception * @param key role ID * @return the status entry * @throws RuntimeException if the role cannot be found */ public RoleStatus lookupRoleStatus(int key) { RoleStatus rs = getRoleStatusMap().get(key); if (rs == null) { throw new RuntimeException("Cannot find role for role ID " + key); } return rs; }
/** * Get diagnostics info about containers */ public String getContainerDiagnosticInfo() { StringBuilder builder = new StringBuilder(); for (RoleStatus roleStatus : getRoleStatusMap().values()) { builder.append(roleStatus).append('\n'); } return builder.toString(); }
/** * Get diagnostics info about containers */ public String getContainerDiagnosticInfo() { StringBuilder builder = new StringBuilder(); for (RoleStatus roleStatus : getRoleStatusMap().values()) { builder.append(roleStatus).append('\n'); } return builder.toString(); }
/** * Build map of role ID-> name * @return */ public Map<Integer, String> buildNamingMap() { Map<Integer, RoleStatus> statusMap = getRoleStatusMap(); Map<Integer, String> naming = new HashMap<>(statusMap.size()); for (Map.Entry<Integer, RoleStatus> entry : statusMap.entrySet()) { naming.put(entry.getKey(), entry.getValue().getName()); } return naming; } }
public synchronized AbstractRMOperation updateBlacklist() { UpdateBlacklistOperation blacklistOperation = roleHistory.updateBlacklist(getRoleStatusMap().values()); if (blacklistOperation != null) { log.info("Updating {}", blacklistOperation); } return blacklistOperation; }
/** * Build map of role ID-> name * @return */ public Map<Integer, String> buildNamingMap() { Map<Integer, RoleStatus> statusMap = getRoleStatusMap(); Map<Integer, String> naming = new HashMap<>(statusMap.size()); for (Map.Entry<Integer, RoleStatus> entry : statusMap.entrySet()) { naming.put(entry.getKey(), entry.getValue().getName()); } return naming; } }
public synchronized AbstractRMOperation updateBlacklist() { UpdateBlacklistOperation blacklistOperation = roleHistory.updateBlacklist(getRoleStatusMap().values()); if (blacklistOperation != null) { log.info("Updating {}", blacklistOperation); } return blacklistOperation; }
public void setHealthThresholdMonitorEnabled(String roleGroup, boolean enabled) { for (RoleStatus rs : getRoleStatusMap().values()) { if (rs.getGroup().equals(roleGroup)) { rs.setHealthThresholdMonitorEnabled(enabled); } } }
/** * Get a snapshot of component information. * <p> * This does <i>not</i> include any container list, which * is more expensive to create. * @return a map of current role status values. */ public Map<String, ComponentInformation> getComponentInfoSnapshot() { Map<Integer, RoleStatus> statusMap = getRoleStatusMap(); Map<String, ComponentInformation> results = new HashMap<>( statusMap.size()); for (RoleStatus status : statusMap.values()) { String name = status.getName(); ComponentInformation info = status.serialize(); results.put(name, info); } return results; }
/** * Get a snapshot of component information. * <p> * This does <i>not</i> include any container list, which * is more expensive to create. * @return a map of current role status values. */ public Map<String, ComponentInformation> getComponentInfoSnapshot() { Map<Integer, RoleStatus> statusMap = getRoleStatusMap(); Map<String, ComponentInformation> results = new HashMap<>( statusMap.size()); for (RoleStatus status : statusMap.values()) { String name = status.getName(); ComponentInformation info = status.serialize(); results.put(name, info); } return results; }
/** * Reset the "recent" failure counts of all roles */ public void resetFailureCounts() { for (RoleStatus roleStatus : getRoleStatusMap().values()) { long failed = roleStatus.resetFailedRecently(); log.info("Resetting failure count of {}; was {}", roleStatus.getName(), failed); } roleHistory.resetFailedRecently(); }
/** * Reset the "recent" failure counts of all roles */ public void resetFailureCounts() { for (RoleStatus roleStatus : getRoleStatusMap().values()) { long failed = roleStatus.resetFailedRecently(); log.info("Resetting failure count of {}; was {}", roleStatus.getName(), failed); } roleHistory.resetFailedRecently(); }
/** * Look at where the current node state is -and whether it should be changed */ public synchronized List<AbstractRMOperation> reviewRequestAndReleaseNodes() throws SliderInternalStateException, TriggerClusterTeardownException { log.debug("in reviewRequestAndReleaseNodes()"); List<AbstractRMOperation> allOperations = new ArrayList<>(); AbstractRMOperation blacklistOperation = updateBlacklist(); if (blacklistOperation != null) { allOperations.add(blacklistOperation); } for (RoleStatus roleStatus : getRoleStatusMap().values()) { if (!roleStatus.isExcludeFromFlexing()) { List<AbstractRMOperation> operations = reviewOneRole(roleStatus); allOperations.addAll(operations); } } return allOperations; }
/** * Look at where the current node state is -and whether it should be changed */ public synchronized List<AbstractRMOperation> reviewRequestAndReleaseNodes() throws SliderInternalStateException, TriggerClusterTeardownException { log.debug("in reviewRequestAndReleaseNodes()"); List<AbstractRMOperation> allOperations = new ArrayList<>(); AbstractRMOperation blacklistOperation = updateBlacklist(); if (blacklistOperation != null) { allOperations.add(blacklistOperation); } for (RoleStatus roleStatus : getRoleStatusMap().values()) { if (!roleStatus.isExcludeFromFlexing()) { List<AbstractRMOperation> operations = reviewOneRole(roleStatus); allOperations.addAll(operations); } } return allOperations; }
/** * Get the aggregate statistics across all roles * @return role statistics */ public RoleStatistics getRoleStatistics() { RoleStatistics stats = new RoleStatistics(); for (RoleStatus role : getRoleStatusMap().values()) { stats.add(role.getStatistics()); } return stats; }
/** * Get the aggregate statistics across all roles * @return role statistics */ public RoleStatistics getRoleStatistics() { RoleStatistics stats = new RoleStatistics(); for (RoleStatus role : getRoleStatusMap().values()) { stats.add(role.getStatistics()); } return stats; }
/** * Return the percentage done that Slider is to have YARN display in its * Web UI * @return an number from 0 to 100 */ public synchronized float getApplicationProgressPercentage() { float percentage; long desired = 0; float actual = 0; for (RoleStatus role : getRoleStatusMap().values()) { desired += role.getDesired(); actual += role.getActual(); } if (desired == 0) { percentage = 100; } else { percentage = actual / desired; } return percentage; }