Exemple #1
0
 private ContainerResourceIncrease ConvertFromProtoFormat(YarnProtos.ContainerResourceIncreaseProto
                                                          p)
 {
     lock (this)
     {
         return(new ContainerResourceIncreasePBImpl(p));
     }
 }
Exemple #2
0
 public virtual YarnProtos.ContainerResourceIncreaseProto GetProto()
 {
     MergeLocalToProto();
     proto = viaProto ? proto : ((YarnProtos.ContainerResourceIncreaseProto)builder.Build
                                     ());
     viaProto = true;
     return(proto);
 }
Exemple #3
0
 private void MergeLocalToProto()
 {
     if (viaProto)
     {
         MaybeInitBuilder();
     }
     MergeLocalToBuilder();
     proto    = ((YarnProtos.ContainerResourceIncreaseProto)builder.Build());
     viaProto = true;
 }
Exemple #4
0
        public virtual void TestResourceIncreaseContextWithNull()
        {
            ContainerResourceIncrease ctx = ContainerResourceIncrease.NewInstance(null, null,
                                                                                  null);

            // get proto and recover to ctx;
            YarnProtos.ContainerResourceIncreaseProto proto = ((ContainerResourceIncreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceIncreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.IsNull(ctx.GetContainerToken());
            NUnit.Framework.Assert.IsNull(ctx.GetCapability());
            NUnit.Framework.Assert.IsNull(ctx.GetContainerId());
        }
Exemple #5
0
        public virtual void TestResourceIncreaseContext()
        {
            byte[] identifier = new byte[] { 1, 2, 3, 4 };
            Token  token      = Token.NewInstance(identifier, string.Empty, Sharpen.Runtime.GetBytesForString
                                                      (string.Empty), string.Empty);
            ContainerId containerId = ContainerId.NewContainerId(ApplicationAttemptId.NewInstance
                                                                     (ApplicationId.NewInstance(1234, 3), 3), 7);
            Resource resource             = Resource.NewInstance(1023, 3);
            ContainerResourceIncrease ctx = ContainerResourceIncrease.NewInstance(containerId
                                                                                  , resource, token);

            // get proto and recover to ctx
            YarnProtos.ContainerResourceIncreaseProto proto = ((ContainerResourceIncreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceIncreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.AreEqual(ctx.GetCapability(), resource);
            NUnit.Framework.Assert.AreEqual(ctx.GetContainerId(), containerId);
            NUnit.Framework.Assert.IsTrue(Arrays.Equals(((byte[])ctx.GetContainerToken().GetIdentifier
                                                             ().Array()), identifier));
        }
Exemple #6
0
 public ContainerResourceIncreasePBImpl(YarnProtos.ContainerResourceIncreaseProto
                                        proto)
 {
     this.proto = proto;
     viaProto   = true;
 }