Example #1
0
 private ContainerResourceDecrease ConvertFromProtoFormat(YarnProtos.ContainerResourceDecreaseProto
                                                          p)
 {
     lock (this)
     {
         return(new ContainerResourceDecreasePBImpl(p));
     }
 }
 public virtual YarnProtos.ContainerResourceDecreaseProto GetProto()
 {
     MergeLocalToProto();
     proto = viaProto ? proto : ((YarnProtos.ContainerResourceDecreaseProto)builder.Build
                                     ());
     viaProto = true;
     return(proto);
 }
 private void MergeLocalToProto()
 {
     if (viaProto)
     {
         MaybeInitBuilder();
     }
     MergeLocalToBuilder();
     proto    = ((YarnProtos.ContainerResourceDecreaseProto)builder.Build());
     viaProto = true;
 }
Example #4
0
        public virtual void TestResourceDecreaseContextWithNull()
        {
            ContainerResourceDecrease ctx = ContainerResourceDecrease.NewInstance(null, null);

            // get proto and recover to ctx;
            YarnProtos.ContainerResourceDecreaseProto proto = ((ContainerResourceDecreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceDecreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.IsNull(ctx.GetCapability());
            NUnit.Framework.Assert.IsNull(ctx.GetContainerId());
        }
Example #5
0
        public virtual void TestResourceDecreaseContext()
        {
            ContainerId containerId = ContainerId.NewContainerId(ApplicationAttemptId.NewInstance
                                                                     (ApplicationId.NewInstance(1234, 3), 3), 7);
            Resource resource             = Resource.NewInstance(1023, 3);
            ContainerResourceDecrease ctx = ContainerResourceDecrease.NewInstance(containerId
                                                                                  , resource);

            // get proto and recover to ctx
            YarnProtos.ContainerResourceDecreaseProto proto = ((ContainerResourceDecreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceDecreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.AreEqual(ctx.GetCapability(), resource);
            NUnit.Framework.Assert.AreEqual(ctx.GetContainerId(), containerId);
        }
 public ContainerResourceDecreasePBImpl(YarnProtos.ContainerResourceDecreaseProto
                                        proto)
 {
     this.proto = proto;
     viaProto   = true;
 }