コード例 #1
0
 public override bool Equals(object other)
 {
     if (other is ContainerResourceIncreaseRequest)
     {
         ContainerResourceIncreaseRequest ctx = (ContainerResourceIncreaseRequest)other;
         if (GetContainerId() == null && ctx.GetContainerId() != null)
         {
             return(false);
         }
         else
         {
             if (!GetContainerId().Equals(ctx.GetContainerId()))
             {
                 return(false);
             }
         }
         if (GetCapability() == null && ctx.GetCapability() != null)
         {
             return(false);
         }
         else
         {
             if (!GetCapability().Equals(ctx.GetCapability()))
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
        public static ContainerResourceIncreaseRequest NewInstance(ContainerId existingContainerId
                                                                   , Resource targetCapability)
        {
            ContainerResourceIncreaseRequest context = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                       <ContainerResourceIncreaseRequest>();

            context.SetContainerId(existingContainerId);
            context.SetCapability(targetCapability);
            return(context);
        }
コード例 #3
0
 public virtual void TestResourceChangeContextWithNullField()
 {
     Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest context = Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest
                                                                                   .NewInstance(null, null);
     // to proto and get it back
     YarnProtos.ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl
                                                                )context).GetProto();
     Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest contextRecover
         = new ContainerResourceIncreaseRequestPBImpl(proto);
     // check value
     NUnit.Framework.Assert.IsNull(contextRecover.GetContainerId());
     NUnit.Framework.Assert.IsNull(contextRecover.GetCapability());
 }
コード例 #4
0
        public virtual void ContainerResourceIncreaseRequest()
        {
            ContainerId containerId = ContainerId.NewContainerId(ApplicationAttemptId.NewInstance
                                                                     (ApplicationId.NewInstance(1234, 3), 3), 7);
            Resource resource = Resource.NewInstance(1023, 3);

            Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest context = Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest
                                                                                          .NewInstance(containerId, resource);
            // to proto and get it back
            YarnProtos.ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl
                                                                       )context).GetProto();
            Org.Apache.Hadoop.Yarn.Api.Records.ContainerResourceIncreaseRequest contextRecover
                = new ContainerResourceIncreaseRequestPBImpl(proto);
            // check value
            NUnit.Framework.Assert.AreEqual(contextRecover.GetContainerId(), containerId);
            NUnit.Framework.Assert.AreEqual(contextRecover.GetCapability(), resource);
        }