use of com.netflix.titus.common.util.tuple.Pair in project titus-control-plane by Netflix.
the class CapacityGroupPodResourcePoolResolver method resolve.
@Override
public List<ResourcePoolAssignment> resolve(Job<?> job, Task task) {
ApplicationSLA capacityGroup = JobManagerUtil.getCapacityGroupDescriptor(job.getJobDescriptor(), capacityGroupService);
if (capacityGroup == null) {
return Collections.emptyList();
}
List<Pair<String, Pattern>> currentMappers = getCurrentMappers();
for (Pair<String, Pattern> next : currentMappers) {
Pattern pattern = next.getRight();
if (pattern.matcher(capacityGroup.getAppName()).matches()) {
return Collections.singletonList(ResourcePoolAssignment.newBuilder().withResourcePoolName(next.getLeft()).withRule(String.format("Capacity group %s matches %s", capacityGroup.getAppName(), pattern.toString())).build());
}
}
return Collections.emptyList();
}
Aggregations