@Override public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request) throws YarnException, IOException { ReservationDeleteRequestProto requestProto = ((ReservationDeleteRequestPBImpl) request).getProto(); try { return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null, requestProto)); } catch (ServiceException e) { RPCUtil.unwrapAndThrowException(e); return null; } }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { // Check if reservation system is enabled checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST); ReservationDeleteResponse response = recordFactory.newRecordInstance(ReservationDeleteResponse.class); // Validate the input Plan plan = rValidator.validateReservationDeleteRequest(reservationSystem, request); ReservationId reservationId = request.getReservationId(); String queueName = reservationSystem.getQueueForReservation(reservationId); // Check ACLs String user = checkReservationACLs(queueName, AuditConstants.DELETE_RESERVATION_REQUEST); // Try to update the reservation using default agent try { boolean result = plan.getReservationAgent().deleteReservation(reservationId, user, plan); if (!result) { String errMsg = "Could not delete reservation: " + reservationId; RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST, errMsg, "ClientRMService", errMsg); throw RPCUtil.getRemoteException(errMsg); } } catch (PlanningException e) { RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST, e.getMessage(), "ClientRMService", "Unable to delete the reservation: " + reservationId); throw RPCUtil.getRemoteException(e); } RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST, "ClientRMService: " + reservationId); return response; }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { // Check if reservation system is enabled checkReservationSytem(AuditConstants.DELETE_RESERVATION_REQUEST); ReservationDeleteResponse response = recordFactory.newRecordInstance(ReservationDeleteResponse.class); // Validate the input Plan plan = rValidator.validateReservationDeleteRequest(reservationSystem, request); ReservationId reservationId = request.getReservationId(); String queueName = reservationSystem.getQueueForReservation(reservationId); // Check ACLs String user = checkReservationACLs(queueName, AuditConstants.DELETE_RESERVATION_REQUEST, reservationId); // Try to update the reservation using default agent try { boolean result = plan.getReservationAgent().deleteReservation(reservationId, user, plan); if (!result) { String errMsg = "Could not delete reservation: " + reservationId; RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST, errMsg, "ClientRMService", errMsg); throw RPCUtil.getRemoteException(errMsg); } } catch (PlanningException e) { RMAuditLogger.logFailure(user, AuditConstants.DELETE_RESERVATION_REQUEST, e.getMessage(), "ClientRMService", "Unable to delete the reservation: " + reservationId); throw RPCUtil.getRemoteException(e); } RMAuditLogger.logSuccess(user, AuditConstants.DELETE_RESERVATION_REQUEST, "ClientRMService: " + reservationId); return response; }
@Test public void testReservationDelete() throws Exception { MiniYARNCluster cluster = setupMiniYARNCluster(); YarnClient client = setupYarnClient(cluster); try { Clock clock = new UTCClock(); long arrival = clock.getTime(); long duration = 60000; long deadline = (long) (arrival + 1.05 * duration); ReservationSubmissionRequest sRequest = submitReservationTestHelper(client, arrival, deadline, duration); ReservationId reservationID = sRequest.getReservationId(); // Delete the reservation ReservationDeleteRequest dRequest = ReservationDeleteRequest.newInstance(reservationID); ReservationDeleteResponse dResponse = client.deleteReservation(dRequest); Assert.assertNotNull(dResponse); System.out.println("Delete reservation response: " + dResponse); // List reservations, search by non-existent reservationID ReservationListRequest request = ReservationListRequest.newInstance( ReservationSystemTestUtil.reservationQ, reservationID.toString(), -1, -1, false); ReservationListResponse response = client.listReservations(request); Assert.assertNotNull(response); Assert.assertEquals(0, response.getReservationAllocationState().size()); } finally { // clean-up if (client != null) { client.stop(); } cluster.stop(); } }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { return rmClient.deleteReservation(request); }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { return client.deleteReservation(request); }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { return null; }
@Override public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest arg0) throws YarnException, IOException { // TODO Auto-generated method stub return null; }
@Override public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException { throw new NotImplementedException(); }
/** * <p> * The interface used by clients to remove an existing Reservation. * </p> * * @param request to remove an existing Reservation (the * {@link ReservationDeleteRequest} should refer to an existing valid * {@link ReservationId}) * @return response empty on successfully deleting the existing reservation * @throws YarnException if the request is invalid or reservation cannot be * deleted successfully * @throws IOException * */ @Public @Unstable public abstract ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException;
/** * <p> * The interface used by clients to remove an existing Reservation. * * Upon deletion of a reservation applications running with this reservation, * are automatically downgraded to normal jobs running without any dedicated * reservation. * </p> * * @param request to remove an existing Reservation (the ReservationRequest * should refer to an existing valid {@link ReservationId}) * @return response empty on successfully deleting the existing reservation * @throws YarnException if the request is invalid or reservation cannot be * deleted successfully * @throws IOException * */ @Public @Unstable public ReservationDeleteResponse deleteReservation( ReservationDeleteRequest request) throws YarnException, IOException;