public static string FindActiveRMHAId(YarnConfiguration conf) { YarnConfiguration yarnConf = new YarnConfiguration(conf); ICollection <string> rmIds = yarnConf.GetStringCollection(YarnConfiguration.RmHaIds ); foreach (string currentId in rmIds) { yarnConf.Set(YarnConfiguration.RmHaId, currentId); try { HAServiceProtocol.HAServiceState haState = GetHAState(yarnConf); if (haState.Equals(HAServiceProtocol.HAServiceState.Active)) { return(currentId); } } catch (Exception) { } } // Couldn't check if this RM is active. Do nothing. Worst case, // we wouldn't find an Active RM and return null. return(null); }
internal virtual void SetHAServiceState(HAServiceProtocol.HAServiceState haServiceState ) { lock (haServiceState) { this.haServiceState = haServiceState; } }
// Couldn't find an Active RM /// <exception cref="System.Exception"/> private static HAServiceProtocol.HAServiceState GetHAState(YarnConfiguration yarnConf ) { HAServiceTarget haServiceTarget; int rpcTimeoutForChecks = yarnConf.GetInt(CommonConfigurationKeys.HaFcCliCheckTimeoutKey , CommonConfigurationKeys.HaFcCliCheckTimeoutDefault); yarnConf.Set(CommonConfigurationKeys.HadoopSecurityServiceUserNameKey, yarnConf.Get (YarnConfiguration.RmPrincipal, string.Empty)); haServiceTarget = new RMHAServiceTarget(yarnConf); HAServiceProtocol proto = haServiceTarget.GetProxy(yarnConf, rpcTimeoutForChecks); HAServiceProtocol.HAServiceState haState = proto.GetServiceStatus().GetState(); return(haState); }
/// <exception cref="System.IO.IOException"/> public virtual HAServiceStatus GetServiceStatus() { lock (this) { CheckAccess("getServiceState"); HAServiceProtocol.HAServiceState haState = rmContext.GetHAServiceState(); HAServiceStatus ret = new HAServiceStatus(haState); if (IsRMActive() || haState == HAServiceProtocol.HAServiceState.Standby) { ret.SetReadyToBecomeActive(); } else { ret.SetNotReadyToBecomeActive("State is " + haState); } return(ret); } }
public ClusterInfo(ResourceManager rm) { // JAXB needs this long ts = ResourceManager.GetClusterTimeStamp(); this.id = ts; this.state = rm.GetServiceState(); this.haState = rm.GetRMContext().GetHAServiceState(); this.rmStateStoreName = rm.GetRMContext().GetStateStore().GetType().FullName; this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.GetVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.GetBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.GetDate(); this.hadoopVersion = VersionInfo.GetVersion(); this.hadoopBuildVersion = VersionInfo.GetBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.GetDate(); this.haZooKeeperConnectionState = rm.GetRMContext().GetRMAdminService().GetHAZookeeperConnectionState (); }
/// <summary>Constructor</summary> /// <param name="name">Name of the state.</param> public HAState(HAServiceProtocol.HAServiceState state) { this.state = state; }
public NNHAStatusHeartbeat(HAServiceProtocol.HAServiceState state, long txid) { this.state = state; this.txid = txid; }
public _Supplier_190(NameNode nn, HAServiceProtocol.HAServiceState state) { this.nn = nn; this.state = state; }
/// <exception cref="Sharpen.TimeoutException"/> /// <exception cref="System.Exception"/> private void WaitForHAState(int nnidx, HAServiceProtocol.HAServiceState state) { NameNode nn = cluster.GetNameNode(nnidx); GenericTestUtils.WaitFor(new _Supplier_190(nn, state), 50, 15000); }