Exemplo n.º 1
0
        public virtual void TestAllcoateRequestWithIncrease()
        {
            IList <ContainerResourceIncreaseRequest> incRequests = new AList <ContainerResourceIncreaseRequest
                                                                              >();

            for (int i = 0; i < 3; i++)
            {
                incRequests.AddItem(ContainerResourceIncreaseRequest.NewInstance(null, Resource.NewInstance
                                                                                     (0, i)));
            }
            AllocateRequest r = AllocateRequest.NewInstance(123, 0f, null, null, null, incRequests
                                                            );

            // serde
            YarnServiceProtos.AllocateRequestProto p = ((AllocateRequestPBImpl)r).GetProto();
            r = new AllocateRequestPBImpl(p);
            // check value
            NUnit.Framework.Assert.AreEqual(123, r.GetResponseId());
            NUnit.Framework.Assert.AreEqual(incRequests.Count, r.GetIncreaseRequests().Count);
            for (int i_1 = 0; i_1 < incRequests.Count; i_1++)
            {
                NUnit.Framework.Assert.AreEqual(r.GetIncreaseRequests()[i_1].GetCapability().GetVirtualCores
                                                    (), incRequests[i_1].GetCapability().GetVirtualCores());
            }
        }
Exemplo n.º 2
0
 public virtual YarnServiceProtos.AllocateRequestProto GetProto()
 {
     MergeLocalToProto();
     proto = viaProto ? proto : ((YarnServiceProtos.AllocateRequestProto)builder.Build
                                     ());
     viaProto = true;
     return(proto);
 }
Exemplo n.º 3
0
 private void MergeLocalToProto()
 {
     if (viaProto)
     {
         MaybeInitBuilder();
     }
     MergeLocalToBuilder();
     proto    = ((YarnServiceProtos.AllocateRequestProto)builder.Build());
     viaProto = true;
 }
Exemplo n.º 4
0
        public virtual void TestAllcoateRequestWithoutIncrease()
        {
            AllocateRequest r = AllocateRequest.NewInstance(123, 0f, null, null, null, null);

            // serde
            YarnServiceProtos.AllocateRequestProto p = ((AllocateRequestPBImpl)r).GetProto();
            r = new AllocateRequestPBImpl(p);
            // check value
            NUnit.Framework.Assert.AreEqual(123, r.GetResponseId());
            NUnit.Framework.Assert.AreEqual(0, r.GetIncreaseRequests().Count);
        }
Exemplo n.º 5
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual AllocateResponse Allocate(AllocateRequest request)
 {
     YarnServiceProtos.AllocateRequestProto requestProto = ((AllocateRequestPBImpl)request
                                                            ).GetProto();
     try
     {
         return(new AllocateResponsePBImpl(proxy.Allocate(null, requestProto)));
     }
     catch (ServiceException e)
     {
         RPCUtil.UnwrapAndThrowException(e);
         return(null);
     }
 }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.AllocateResponseProto Allocate(RpcController arg0
                                                                        , YarnServiceProtos.AllocateRequestProto proto)
        {
            AllocateRequestPBImpl request = new AllocateRequestPBImpl(proto);

            try
            {
                AllocateResponse response = real.Allocate(request);
                return(((AllocateResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Exemplo n.º 7
0
 public AllocateRequestPBImpl(YarnServiceProtos.AllocateRequestProto proto)
 {
     this.proto = proto;
     viaProto   = true;
 }