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()); } }
public virtual YarnServiceProtos.AllocateRequestProto GetProto() { MergeLocalToProto(); proto = viaProto ? proto : ((YarnServiceProtos.AllocateRequestProto)builder.Build ()); viaProto = true; return(proto); }
private void MergeLocalToProto() { if (viaProto) { MaybeInitBuilder(); } MergeLocalToBuilder(); proto = ((YarnServiceProtos.AllocateRequestProto)builder.Build()); viaProto = true; }
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); }
/// <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); } }
public AllocateRequestPBImpl(YarnServiceProtos.AllocateRequestProto proto) { this.proto = proto; viaProto = true; }