/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestRegisterApplicationMasterOnHA()
        {
            RegisterApplicationMasterRequest request = RegisterApplicationMasterRequest.NewInstance
                                                           ("localhost", 0, string.Empty);
            RegisterApplicationMasterResponse response = amClient.RegisterApplicationMaster(request
                                                                                            );

            NUnit.Framework.Assert.AreEqual(response, this.cluster.CreateFakeRegisterApplicationMasterResponse
                                                ());
        }
示例#2
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private RegisterApplicationMasterResponse RegisterApplicationMaster()
        {
            RegisterApplicationMasterRequest request = RegisterApplicationMasterRequest.NewInstance
                                                           (this.appHostName, this.appHostPort, this.appTrackingUrl);
            RegisterApplicationMasterResponse response = rmClient.RegisterApplicationMaster(request
                                                                                            );

            lock (this)
            {
                lastResponseId = 0;
                if (!response.GetNMTokensFromPreviousAttempts().IsEmpty())
                {
                    PopulateNMTokens(response.GetNMTokensFromPreviousAttempts());
                }
            }
            return(response);
        }
 // Expected
 // provide main method so this class can act as AM
 /// <exception cref="System.Exception"/>
 public static void Main(string[] args)
 {
     if (args[0].Equals("success"))
     {
         ApplicationMasterProtocol client = ClientRMProxy.CreateRMProxy <ApplicationMasterProtocol
                                                                         >(conf);
         client.RegisterApplicationMaster(RegisterApplicationMasterRequest.NewInstance(NetUtils
                                                                                       .GetHostname(), -1, string.Empty));
         Sharpen.Thread.Sleep(1000);
         FinishApplicationMasterResponse resp = client.FinishApplicationMaster(FinishApplicationMasterRequest
                                                                               .NewInstance(FinalApplicationStatus.Succeeded, "success", null));
         NUnit.Framework.Assert.IsTrue(resp.GetIsUnregistered());
         System.Environment.Exit(0);
     }
     else
     {
         System.Environment.Exit(1);
     }
 }