private void StartResourceManager(int index) { lock (this) { try { Sharpen.Thread rmThread = new _Thread_310(this, index); rmThread.SetName("RM-" + index); rmThread.Start(); int waitCount = 0; while (resourceManagers[index].GetServiceState() == Service.STATE.Inited && waitCount ++ < 60) { Log.Info("Waiting for RM to start..."); Sharpen.Thread.Sleep(1500); } if (resourceManagers[index].GetServiceState() != Service.STATE.Started) { // RM could have failed. throw new IOException("ResourceManager failed to start. Final state is " + resourceManagers [index].GetServiceState()); } } catch (Exception t) { throw new YarnRuntimeException(t); } Log.Info("MiniYARN ResourceManager address: " + GetConfig().Get(YarnConfiguration .RmAddress)); Log.Info("MiniYARN ResourceManager web address: " + WebAppUtils.GetRMWebAppURLWithoutScheme (GetConfig())); } }
/// <exception cref="System.Exception"/> protected override void ServiceStart() { lock (this) { try { if (!this.GetConfig().GetBoolean(JHAdminConfig.MrHistoryMiniclusterFixedPorts, JHAdminConfig .DefaultMrHistoryMiniclusterFixedPorts)) { string hostname = MiniYARNCluster.GetHostname(); // pick free random ports. this.GetConfig().Set(JHAdminConfig.MrHistoryAddress, hostname + ":0"); MRWebAppUtil.SetJHSWebappURLWithoutScheme(this.GetConfig(), hostname + ":0"); this.GetConfig().Set(JHAdminConfig.JhsAdminAddress, hostname + ":0"); } this._enclosing.historyServer = new JobHistoryServer(); this._enclosing.historyServer.Init(this.GetConfig()); new _Thread_212(this).Start(); while (!this.jhsStarted) { MiniMRYarnCluster.Log.Info("Waiting for HistoryServer to start..."); Sharpen.Thread.Sleep(1500); } //TODO Add a timeout. State.STOPPED check ? if (this._enclosing.historyServer.GetServiceState() != Service.STATE.Started) { throw new IOException("HistoryServer failed to start"); } base.ServiceStart(); } catch (Exception t) { throw new YarnRuntimeException(t); } //need to do this because historyServer.init creates a new Configuration this.GetConfig().Set(JHAdminConfig.MrHistoryAddress, this._enclosing.historyServer .GetConfig().Get(JHAdminConfig.MrHistoryAddress)); MRWebAppUtil.SetJHSWebappURLWithoutScheme(this.GetConfig(), MRWebAppUtil.GetJHSWebappURLWithoutScheme (this._enclosing.historyServer.GetConfig())); MiniMRYarnCluster.Log.Info("MiniMRYARN ResourceManager address: " + this.GetConfig ().Get(YarnConfiguration.RmAddress)); MiniMRYarnCluster.Log.Info("MiniMRYARN ResourceManager web address: " + WebAppUtils .GetRMWebAppURLWithoutScheme(this.GetConfig())); MiniMRYarnCluster.Log.Info("MiniMRYARN HistoryServer address: " + this.GetConfig( ).Get(JHAdminConfig.MrHistoryAddress)); MiniMRYarnCluster.Log.Info("MiniMRYARN HistoryServer web address: " + MiniMRYarnCluster .GetResolvedMRHistoryWebAppURLWithoutScheme(this.GetConfig(), MRWebAppUtil.GetJHSHttpPolicy () == HttpConfig.Policy.HttpsOnly)); } }
/// <exception cref="System.Exception"/> protected override void ServiceStart() { lock (this) { this._enclosing.StartResourceManager(this.index); MiniYARNCluster.Log.Info("MiniYARN ResourceManager address: " + this.GetConfig(). Get(YarnConfiguration.RmAddress)); MiniYARNCluster.Log.Info("MiniYARN ResourceManager web address: " + WebAppUtils.GetRMWebAppURLWithoutScheme (this.GetConfig())); base.ServiceStart(); } }