use of org.apache.hadoop.ha.HAServiceProtocol.HAServiceState in project hadoop by apache.
the class PBHelper method convert.
public static NamespaceInfoProto convert(NamespaceInfo info) {
NamespaceInfoProto.Builder builder = NamespaceInfoProto.newBuilder();
builder.setBlockPoolID(info.getBlockPoolID()).setBuildVersion(info.getBuildVersion()).setUnused(0).setStorageInfo(PBHelper.convert((StorageInfo) info)).setSoftwareVersion(info.getSoftwareVersion()).setCapabilities(info.getCapabilities());
HAServiceState state = info.getState();
if (state != null) {
builder.setState(convert(info.getState()));
}
return builder.build();
}
use of org.apache.hadoop.ha.HAServiceProtocol.HAServiceState in project hadoop by apache.
the class RMHAUtils method findActiveRMHAId.
public static String findActiveRMHAId(YarnConfiguration conf) {
YarnConfiguration yarnConf = new YarnConfiguration(conf);
Collection<String> rmIds = yarnConf.getStringCollection(YarnConfiguration.RM_HA_IDS);
for (String currentId : rmIds) {
yarnConf.set(YarnConfiguration.RM_HA_ID, currentId);
try {
HAServiceState haState = getHAState(yarnConf);
if (haState.equals(HAServiceState.ACTIVE)) {
return currentId;
}
} catch (Exception e) {
// Couldn't check if this RM is active. Do nothing. Worst case,
// we wouldn't find an Active RM and return null.
}
}
// Couldn't find an Active RM
return null;
}
Aggregations