Search in sources :

Example 6 with PreemptionContainer

use of org.apache.hadoop.yarn.api.records.PreemptionContainer in project hadoop by apache.

the class TestKillAMPreemptionPolicy method getPreemptionMessage.

private PreemptionMessage getPreemptionMessage(boolean strictContract, boolean contract, final ContainerId container) {
    PreemptionMessage preemptionMessage = recordFactory.newRecordInstance(PreemptionMessage.class);
    Set<PreemptionContainer> cntrs = new HashSet<PreemptionContainer>();
    PreemptionContainer preemptContainer = recordFactory.newRecordInstance(PreemptionContainer.class);
    preemptContainer.setId(container);
    cntrs.add(preemptContainer);
    if (strictContract) {
        StrictPreemptionContract set = recordFactory.newRecordInstance(StrictPreemptionContract.class);
        set.setContainers(cntrs);
        preemptionMessage.setStrictContract(set);
    }
    if (contract) {
        PreemptionContract preemptContract = recordFactory.newRecordInstance(PreemptionContract.class);
        preemptContract.setContainers(cntrs);
        preemptionMessage.setContract(preemptContract);
    }
    return preemptionMessage;
}
Also used : StrictPreemptionContract(org.apache.hadoop.yarn.api.records.StrictPreemptionContract) PreemptionMessage(org.apache.hadoop.yarn.api.records.PreemptionMessage) PreemptionContainer(org.apache.hadoop.yarn.api.records.PreemptionContainer) PreemptionContract(org.apache.hadoop.yarn.api.records.PreemptionContract) StrictPreemptionContract(org.apache.hadoop.yarn.api.records.StrictPreemptionContract) HashSet(java.util.HashSet)

Example 7 with PreemptionContainer

use of org.apache.hadoop.yarn.api.records.PreemptionContainer in project hadoop by apache.

the class StrictPreemptionContractPBImpl method initIds.

private void initIds() {
    if (containers != null) {
        return;
    }
    StrictPreemptionContractProtoOrBuilder p = viaProto ? proto : builder;
    List<PreemptionContainerProto> list = p.getContainerList();
    containers = new HashSet<PreemptionContainer>();
    for (PreemptionContainerProto c : list) {
        containers.add(convertFromProtoFormat(c));
    }
}
Also used : PreemptionContainerProto(org.apache.hadoop.yarn.proto.YarnProtos.PreemptionContainerProto) StrictPreemptionContractProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnProtos.StrictPreemptionContractProtoOrBuilder) PreemptionContainer(org.apache.hadoop.yarn.api.records.PreemptionContainer)

Aggregations

PreemptionContainer (org.apache.hadoop.yarn.api.records.PreemptionContainer)7 PreemptionContract (org.apache.hadoop.yarn.api.records.PreemptionContract)5 StrictPreemptionContract (org.apache.hadoop.yarn.api.records.StrictPreemptionContract)5 HashSet (java.util.HashSet)3 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)3 PreemptionMessage (org.apache.hadoop.yarn.api.records.PreemptionMessage)3 PreemptionResourceRequest (org.apache.hadoop.yarn.api.records.PreemptionResourceRequest)3 ResourceRequest (org.apache.hadoop.yarn.api.records.ResourceRequest)3 ArrayList (java.util.ArrayList)2 PreemptionContainerProto (org.apache.hadoop.yarn.proto.YarnProtos.PreemptionContainerProto)2 TaskAttemptId (org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId)1 Container (org.apache.hadoop.yarn.api.records.Container)1 Resource (org.apache.hadoop.yarn.api.records.Resource)1 PreemptionContractProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.PreemptionContractProtoOrBuilder)1 StrictPreemptionContractProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnProtos.StrictPreemptionContractProtoOrBuilder)1