@Test public void testSubmitReservationDoesnotExist() { ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl(); Plan plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); Assert.fail(); } catch (YarnException e) { Assert.assertNull(plan); String message = e.getMessage(); Assert .assertTrue(message .equals("The queue to submit is not specified. Please try again with a valid reservable queue.")); LOG.info(message); } }
@Test public void testSubmitReservationNoDefinition() { ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl(); request.setQueue(PLAN_NAME); Plan plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); Assert.fail(); } catch (YarnException e) { Assert.assertNull(plan); String message = e.getMessage(); Assert .assertTrue(message .equals("Missing reservation definition. Please try again by specifying a reservation definition.")); LOG.info(message); } }
private ReservationSubmissionRequest createSimpleReservationSubmissionRequest( int numRequests, int numContainers, long arrival, long deadline, long duration) { // create a request with a single atomic ask ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl(); ReservationDefinition rDef = new ReservationDefinitionPBImpl(); rDef.setArrival(arrival); rDef.setDeadline(deadline); if (numRequests > 0) { ReservationRequests reqs = new ReservationRequestsPBImpl(); rDef.setReservationRequests(reqs); if (numContainers > 0) { ReservationRequest r = ReservationRequest.newInstance(Resource.newInstance(1024, 1, 1), numContainers, 1, duration); reqs.setReservationResources(Collections.singletonList(r)); reqs.setInterpreter(ReservationRequestInterpreter.R_ALL); } } request.setQueue(PLAN_NAME); request.setReservationDefinition(rDef); return request; }
private ReservationSubmissionRequest createSimpleReservationSubmissionRequest( int numRequests, int numContainers, long arrival, long deadline, long duration) { // create a request with a single atomic ask ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl(); ReservationDefinition rDef = new ReservationDefinitionPBImpl(); rDef.setArrival(arrival); rDef.setDeadline(deadline); if (numRequests > 0) { ReservationRequests reqs = new ReservationRequestsPBImpl(); rDef.setReservationRequests(reqs); if (numContainers > 0) { ReservationRequest r = ReservationRequest.newInstance(Resource.newInstance(1024, 1), numContainers, 1, duration); reqs.setReservationResources(Collections.singletonList(r)); reqs.setInterpreter(ReservationRequestInterpreter.R_ALL); } } request.setQueue(PLAN_NAME); request.setReservationDefinition(rDef); return request; }
@Test public void testSubmitReservationDoesNotExist() { ReservationSubmissionRequest request = new ReservationSubmissionRequestPBImpl(); Plan plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); Assert.fail(); } catch (YarnException e) { Assert.assertNull(plan); String message = e.getMessage(); Assert .assertTrue(message .equals("The queue is not specified. Please try again with a valid reservable queue.")); LOG.info(message); } }
@Override public ReservationSubmissionResponse submitReservation(ReservationSubmissionRequest request) throws YarnException, IOException { ReservationSubmissionRequestProto requestProto = ((ReservationSubmissionRequestPBImpl) request).getProto(); try { return new ReservationSubmissionResponsePBImpl(proxy.submitReservation(null, requestProto)); } catch (ServiceException e) { RPCUtil.unwrapAndThrowException(e); return null; } }
@Test public void testReservationSubmissionRequestPBImpl() throws Exception { validatePBImplRecord(ReservationSubmissionRequestPBImpl.class, ReservationSubmissionRequestProto.class); }