Example #1
0
 private static double getDiskFrom(Protos.TaskInfo taskInfo) {
   for (Protos.Resource resource : taskInfo.getResourcesList()) {
     if (resource.getName() == "disk") {
       return resource.getScalar().getValue();
     }
   }
   return -1;
 }
Example #2
0
 private static int getPortsFrom(Protos.TaskInfo taskInfo) {
   double portCount = 0;
   for (Protos.Resource resource : taskInfo.getResourcesList()) {
     if (resource.getName() == "ports") {
       for (Protos.Value.Range range : resource.getRanges().getRangeList()) {
         portCount = 1 + range.getEnd() - range.getBegin();
       }
     }
   }
   return (int) portCount;
 }