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;
}
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));
}
}
Aggregations