Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.AddReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.AddReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterResponse;

/**
* FederationReservationHomeSubClusterStore maintains the state of all
Expand Down Expand Up @@ -86,4 +90,30 @@ GetReservationHomeSubClusterResponse getReservationHomeSubCluster(
GetReservationsHomeSubClusterResponse getReservationsHomeSubCluster(
GetReservationsHomeSubClusterRequest request) throws YarnException;

/**
* Update the home {@code SubClusterId} of a previously submitted
* {@code ReservationId}. Currently response is empty if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @param request the request to update the home sub-cluster of a reservation.
* @return empty on successful update of the Reservation in the StateStore, if
* not an exception reporting reason for a failure
* @throws YarnException if the request is invalid/fails
*/
UpdateReservationHomeSubClusterResponse updateReservationHomeSubCluster(
UpdateReservationHomeSubClusterRequest request) throws YarnException;


/**
* Delete the mapping of home {@code SubClusterId} of a previously submitted
* {@code ReservationId}. Currently response is empty if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @param request the request to delete the home sub-cluster of a reservation.
* @return empty on successful update of the Reservation in the StateStore, if
* not an exception reporting reason for a failure
* @throws YarnException if the request is invalid/fails
*/
DeleteReservationHomeSubClusterResponse deleteReservationHomeSubCluster(
DeleteReservationHomeSubClusterRequest request) throws YarnException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.ReservationHomeSubCluster;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationApplicationHomeSubClusterStoreInputValidator;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationReservationHomeSubClusterStoreInputValidator;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationMembershipStateStoreInputValidator;
Expand Down Expand Up @@ -365,4 +369,31 @@ public GetReservationsHomeSubClusterResponse getReservationsHomeSubCluster(

return GetReservationsHomeSubClusterResponse.newInstance(result);
}

@Override
public UpdateReservationHomeSubClusterResponse updateReservationHomeSubCluster(
UpdateReservationHomeSubClusterRequest request) throws YarnException {
FederationReservationHomeSubClusterStoreInputValidator.validate(request);
ReservationId reservationId = request.getReservationHomeSubCluster().getReservationId();

if (!reservations.containsKey(reservationId)) {
throw new YarnException("Reservation " + reservationId + " does not exist.");
}

SubClusterId subClusterId = request.getReservationHomeSubCluster().getHomeSubCluster();
reservations.put(reservationId, subClusterId);
return UpdateReservationHomeSubClusterResponse.newInstance();
}

@Override
public DeleteReservationHomeSubClusterResponse deleteReservationHomeSubCluster(
DeleteReservationHomeSubClusterRequest request) throws YarnException {
FederationReservationHomeSubClusterStoreInputValidator.validate(request);
ReservationId reservationId = request.getReservationId();
if (!reservations.containsKey(reservationId)) {
throw new YarnException("Reservation " + reservationId + " does not exist");
}
reservations.remove(reservationId);
return DeleteReservationHomeSubClusterResponse.newInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationApplicationHomeSubClusterStoreInputValidator;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationMembershipStateStoreInputValidator;
import org.apache.hadoop.yarn.server.federation.store.utils.FederationPolicyStoreInputValidator;
Expand Down Expand Up @@ -1027,4 +1031,16 @@ public GetReservationsHomeSubClusterResponse getReservationsHomeSubCluster(
GetReservationsHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}

@Override
public DeleteReservationHomeSubClusterResponse deleteReservationHomeSubCluster(
DeleteReservationHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}

@Override
public UpdateReservationHomeSubClusterResponse updateReservationHomeSubCluster(
UpdateReservationHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.GetReservationsHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateReservationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterIdPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterInfoPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterPolicyConfigurationPBImpl;
Expand Down Expand Up @@ -662,4 +666,16 @@ public GetReservationsHomeSubClusterResponse getReservationsHomeSubCluster(
GetReservationsHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}

@Override
public DeleteReservationHomeSubClusterResponse deleteReservationHomeSubCluster(
DeleteReservationHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}

@Override
public UpdateReservationHomeSubClusterResponse updateReservationHomeSubCluster(
UpdateReservationHomeSubClusterRequest request) throws YarnException {
throw new NotImplementedException("Code is not implemented");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.apache.hadoop.yarn.server.federation.store.records;

import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;

/**
* The request to <code>Federation state store</code> to delete the mapping of
* home subcluster of a submitted reservation.
*/
@Private
@Unstable
public abstract class DeleteReservationHomeSubClusterRequest {

@Private
@Unstable
public static DeleteReservationHomeSubClusterRequest newInstance(
ReservationId reservationId) {
DeleteReservationHomeSubClusterRequest deleteReservationRequest =
Records.newRecord(DeleteReservationHomeSubClusterRequest.class);
deleteReservationRequest.setReservationId(reservationId);
return deleteReservationRequest;
}

/**
* Get the identifier of the {@link ReservationId} to be removed from
* <code>Federation state store</code> .
*
* @return the identifier of the Reservation to be removed from Federation
* State Store.
*/
@Public
@Unstable
public abstract ReservationId getReservationId();

/**
* Set the identifier of the {@link ReservationId} to be removed from
* <code>Federation state store</code> .
*
* @param reservationId the identifier of the Reservation to be removed from
* Federation State Store.
*/
@Private
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.apache.hadoop.yarn.server.federation.store.records;

import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;

/**
* DeleteReservationHomeSubClusterResponse contains the answer from the {@code
* FederationReservationHomeSubClusterStore} to a request to delete the mapping
* of home subcluster of a submitted reservation. Currently, response is empty if
* the operation was successful, if not an exception reporting reason for a
* failure.
*/
@Private
@Unstable
public abstract class DeleteReservationHomeSubClusterResponse {

@Private
@Unstable
public static DeleteReservationHomeSubClusterResponse newInstance() {
DeleteReservationHomeSubClusterResponse response =
Records.newRecord(DeleteReservationHomeSubClusterResponse.class);
return response;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.apache.hadoop.yarn.server.federation.store.records;

import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;

/**
* <p>
* The request sent by the <code>Router</code> to
* <code>Federation state store</code> to update the home subcluster of a newly
* submitted reservation.
*
* <p>
* The request includes the mapping details, i.e.:
* <ul>
* <li>{@code ReservationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*/
@Private
@Unstable
public abstract class UpdateReservationHomeSubClusterRequest {

@Private
@Unstable
public static UpdateReservationHomeSubClusterRequest newInstance(
ReservationHomeSubCluster reservationHomeSubCluster) {
UpdateReservationHomeSubClusterRequest updateReservationRequest =
Records.newRecord(UpdateReservationHomeSubClusterRequest.class);
updateReservationRequest
.setReservationHomeSubCluster(reservationHomeSubCluster);
return updateReservationRequest;
}

/**
* Get the {@link ReservationHomeSubCluster} representing the mapping of the
* reservation to it's home sub-cluster.
*
* @return the mapping of the reservation to it's home sub-cluster.
*/
@Public
@Unstable
public abstract ReservationHomeSubCluster getReservationHomeSubCluster();

/**
* Set the {@link ReservationHomeSubCluster} representing the mapping of the
* reservation to it's home sub-cluster.
*
* @param reservationHomeSubCluster the mapping of the reservation to it's
* home sub-cluster.
*/
@Private
@Unstable
public abstract void setReservationHomeSubCluster(
ReservationHomeSubCluster reservationHomeSubCluster);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package org.apache.hadoop.yarn.server.federation.store.records;

import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;

/**
* UpdateReservationHomeSubClusterResponse contains the answer from the
* {@code FederationReservationHomeSubClusterStore} to a request to register the
* home subcluster of a submitted reservation. Currently response is empty if
* the operation was successful, if not an exception reporting reason for a
* failure.
*/
@Private
@Unstable
public abstract class UpdateReservationHomeSubClusterResponse {

@Private
@Unstable
public static UpdateReservationHomeSubClusterResponse newInstance() {
UpdateReservationHomeSubClusterResponse response =
Records.newRecord(UpdateReservationHomeSubClusterResponse.class);
return response;
}

}
Loading