YARN-756. Move Preemption* records to yarn.api where they really belong. Contributed by Jian He.
svn merge --ignore-ancestry -c 1489290 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1489291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f20c37919
commit
3adbeff801
|
@ -73,6 +73,9 @@ Release 2.1.0-beta - UNRELEASED
|
|||
YARN-635. Renamed YarnRemoteException to YarnException. (Siddharth Seth via
|
||||
vinodkv)
|
||||
|
||||
YARN-756. Move Preemption* records to yarn.api where they really belong.
|
||||
(Jian He via vinodkv)
|
||||
|
||||
NEW FEATURES
|
||||
|
||||
YARN-482. FS: Extend SchedulingMode to intermediate queues.
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.hadoop.yarn.api.AMRMProtocol;
|
|||
import org.apache.hadoop.yarn.api.records.Container;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||
import org.apache.hadoop.yarn.api.records.NodeReport;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.api.records.Token;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Public;
|
|||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,12 +25,13 @@ import java.util.List;
|
|||
|
||||
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.Container;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||
import org.apache.hadoop.yarn.api.records.NodeReport;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.api.records.Token;
|
||||
import org.apache.hadoop.yarn.api.records.impl.PreemptionMessagePBImpl;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerStatusPBImpl;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.NodeReportPBImpl;
|
||||
|
|
|
@ -15,30 +15,36 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
package org.apache.hadoop.yarn.api.records;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* Specific container requested back by the <code>ResourceManager</code>.
|
||||
* @see PreemptionContract
|
||||
* @see StrictPreemptionContract
|
||||
*/
|
||||
public interface PreemptionContainer {
|
||||
public abstract class PreemptionContainer {
|
||||
|
||||
public static PreemptionContainer newInstance(ContainerId id) {
|
||||
PreemptionContainer container = Records.newRecord(PreemptionContainer.class);
|
||||
container.setId(id);
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Container referenced by this handle.
|
||||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public ContainerId getId();
|
||||
public abstract ContainerId getId();
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setId(ContainerId id);
|
||||
public abstract void setId(ContainerId id);
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
package org.apache.hadoop.yarn.api.records;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -24,6 +24,9 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionResourceRequest;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* Description of resources requested back by the <code>ResourceManager</code>.
|
||||
|
@ -32,7 +35,15 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|||
* the platform.
|
||||
* @see PreemptionMessage
|
||||
*/
|
||||
public interface PreemptionContract {
|
||||
public abstract class PreemptionContract {
|
||||
|
||||
public static PreemptionContract newInstance(
|
||||
List<PreemptionResourceRequest> req, Set<PreemptionContainer> containers) {
|
||||
PreemptionContract contract = Records.newRecord(PreemptionContract.class);
|
||||
contract.setResourceRequest(req);
|
||||
contract.setContainers(containers);
|
||||
return contract;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the AM releases resources matching these requests, then the {@link
|
||||
|
@ -47,11 +58,11 @@ public interface PreemptionContract {
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public List<PreemptionResourceRequest> getResourceRequest();
|
||||
public abstract List<PreemptionResourceRequest> getResourceRequest();
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setResourceRequest(List<PreemptionResourceRequest> req);
|
||||
public abstract void setResourceRequest(List<PreemptionResourceRequest> req);
|
||||
|
||||
/**
|
||||
* Assign the set of {@link PreemptionContainer} specifying which containers
|
||||
|
@ -63,11 +74,11 @@ public interface PreemptionContract {
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public Set<PreemptionContainer> getContainers();
|
||||
public abstract Set<PreemptionContainer> getContainers();
|
||||
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setContainers(Set<PreemptionContainer> containers);
|
||||
public abstract void setContainers(Set<PreemptionContainer> containers);
|
||||
|
||||
}
|
|
@ -15,12 +15,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
package org.apache.hadoop.yarn.api.records;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* A {@link PreemptionMessage} is part of the RM-AM protocol, and it is used by
|
||||
|
@ -56,7 +57,15 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public interface PreemptionMessage {
|
||||
public abstract class PreemptionMessage {
|
||||
|
||||
public static PreemptionMessage newInstance(StrictPreemptionContract set,
|
||||
PreemptionContract contract) {
|
||||
PreemptionMessage message = Records.newRecord(PreemptionMessage.class);
|
||||
message.setStrictContract(set);
|
||||
message.setContract(contract);
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Specific resources that may be killed by the
|
||||
|
@ -64,21 +73,21 @@ public interface PreemptionMessage {
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public StrictPreemptionContract getStrictContract();
|
||||
public abstract StrictPreemptionContract getStrictContract();
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setStrictContract(StrictPreemptionContract set);
|
||||
public abstract void setStrictContract(StrictPreemptionContract set);
|
||||
|
||||
/**
|
||||
* @return Contract describing resources to return to the cluster.
|
||||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public PreemptionContract getContract();
|
||||
public abstract PreemptionContract getContract();
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setContract(PreemptionContract contract);
|
||||
public abstract void setContract(PreemptionContract contract);
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
package org.apache.hadoop.yarn.api.records;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Evolving;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* Enumeration of particular allocations to be reclaimed. The platform will
|
||||
|
@ -35,7 +35,14 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public interface StrictPreemptionContract {
|
||||
public abstract class StrictPreemptionContract {
|
||||
|
||||
public static StrictPreemptionContract newInstance(Set<PreemptionContainer> containers) {
|
||||
StrictPreemptionContract contract =
|
||||
Records.newRecord(StrictPreemptionContract.class);
|
||||
contract.setContainers(containers);
|
||||
return contract;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of {@link PreemptionContainer} specifying containers owned by
|
||||
|
@ -45,10 +52,10 @@ public interface StrictPreemptionContract {
|
|||
*/
|
||||
@Public
|
||||
@Evolving
|
||||
public Set<PreemptionContainer> getContainers();
|
||||
public abstract Set<PreemptionContainer> getContainers();
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public void setContainers(Set<PreemptionContainer> containers);
|
||||
public abstract void setContainers(Set<PreemptionContainer> containers);
|
||||
|
||||
}
|
|
@ -15,16 +15,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
package org.apache.hadoop.yarn.api.records.impl;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContainerProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContainerProtoOrBuilder;
|
||||
|
||||
public class PreemptionContainerPBImpl implements PreemptionContainer {
|
||||
public class PreemptionContainerPBImpl extends PreemptionContainer {
|
||||
|
||||
PreemptionContainerProto proto =
|
||||
PreemptionContainerProto.getDefaultInstance();
|
|
@ -15,7 +15,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
package org.apache.hadoop.yarn.api.records.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -23,16 +23,16 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionResourceRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.PreemptionResourceRequestPBImpl;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContainerProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContractProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContractProtoOrBuilder;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionResourceRequestProto;
|
||||
|
||||
public class PreemptionContractPBImpl implements PreemptionContract {
|
||||
public class PreemptionContractPBImpl extends PreemptionContract {
|
||||
|
||||
PreemptionContractProto proto = PreemptionContractProto.getDefaultInstance();
|
||||
PreemptionContractProto.Builder builder = null;
|
|
@ -15,17 +15,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
package org.apache.hadoop.yarn.api.records.impl;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContractProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionMessageProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionMessageProtoOrBuilder;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.StrictPreemptionContractProto;
|
||||
|
||||
public class PreemptionMessagePBImpl implements PreemptionMessage {
|
||||
public class PreemptionMessagePBImpl extends PreemptionMessage {
|
||||
|
||||
PreemptionMessageProto proto = PreemptionMessageProto.getDefaultInstance();
|
||||
PreemptionMessageProto.Builder builder = null;
|
|
@ -15,20 +15,20 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
package org.apache.hadoop.yarn.api.records.impl;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.records.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.PreemptionContainerProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.StrictPreemptionContractProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.StrictPreemptionContractProtoOrBuilder;
|
||||
|
||||
public class StrictPreemptionContractPBImpl implements StrictPreemptionContract {
|
||||
public class StrictPreemptionContractPBImpl extends StrictPreemptionContract {
|
||||
|
||||
StrictPreemptionContractProto proto =
|
||||
StrictPreemptionContractProto.getDefaultInstance();
|
|
@ -32,7 +32,6 @@ import org.apache.hadoop.net.NetUtils;
|
|||
import org.apache.hadoop.security.SecurityUtil;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
|
@ -52,6 +51,7 @@ import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
|
|||
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||
import org.apache.hadoop.yarn.api.records.NodeReport;
|
||||
import org.apache.hadoop.yarn.api.records.NodeState;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.Priority;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||
|
|
|
@ -41,19 +41,19 @@ import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionResourceRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.api.records.NodeReport;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContainer;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionContract;
|
||||
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.api.records.ResourceRequest;
|
||||
import org.apache.hadoop.yarn.api.records.StrictPreemptionContract;
|
||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||
|
|
Loading…
Reference in New Issue