Пример #1
0
        // 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);
        }
Пример #2
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual HAServiceProtocolProtos.GetServiceStatusResponseProto GetServiceStatus
            (RpcController controller, HAServiceProtocolProtos.GetServiceStatusRequestProto
            request)
        {
            HAServiceStatus s;

            try
            {
                s = server.GetServiceStatus();
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            HAServiceProtocolProtos.HAServiceStateProto retState;
            switch (s.GetState())
            {
            case HAServiceProtocol.HAServiceState.Active:
            {
                retState = HAServiceProtocolProtos.HAServiceStateProto.Active;
                break;
            }

            case HAServiceProtocol.HAServiceState.Standby:
            {
                retState = HAServiceProtocolProtos.HAServiceStateProto.Standby;
                break;
            }

            case HAServiceProtocol.HAServiceState.Initializing:
            default:
            {
                retState = HAServiceProtocolProtos.HAServiceStateProto.Initializing;
                break;
            }
            }
            HAServiceProtocolProtos.GetServiceStatusResponseProto.Builder ret = HAServiceProtocolProtos.GetServiceStatusResponseProto
                                                                                .NewBuilder().SetState(retState).SetReadyToBecomeActive(s.IsReadyToBecomeActive(
                                                                                                                                            ));
            if (!s.IsReadyToBecomeActive())
            {
                ret.SetNotReadyReason(s.GetNotReadyReason());
            }
            return((HAServiceProtocolProtos.GetServiceStatusResponseProto)ret.Build());
        }
Пример #3
0
        public virtual void Configure()
        {
            remoteAdminServiceAccessed = false;
            admin = Org.Mockito.Mockito.Mock <ResourceManagerAdministrationProtocol>();
            Org.Mockito.Mockito.When(admin.AddToClusterNodeLabels(Matchers.Any <AddToClusterNodeLabelsRequest
                                                                                >())).ThenAnswer(new _Answer_79(this));
            haadmin = Org.Mockito.Mockito.Mock <HAServiceProtocol>();
            Org.Mockito.Mockito.When(haadmin.GetServiceStatus()).ThenReturn(new HAServiceStatus
                                                                                (HAServiceProtocol.HAServiceState.Initializing));
            HAServiceTarget haServiceTarget = Org.Mockito.Mockito.Mock <HAServiceTarget>();

            Org.Mockito.Mockito.When(haServiceTarget.GetProxy(Matchers.Any <Configuration>(),
                                                              Matchers.AnyInt())).ThenReturn(haadmin);
            rmAdminCLI = new _RMAdminCLI_96(this, haServiceTarget, new Configuration());
            InitDummyNodeLabelsManager();
            rmAdminCLI.localNodeLabelsManager = dummyNodeLabelsManager;
            YarnConfiguration conf = new YarnConfiguration();

            conf.SetBoolean(YarnConfiguration.RmHaEnabled, true);
            rmAdminCLIWithHAEnabled = new _RMAdminCLI_113(this, haServiceTarget, conf);
        }