code: @VisibleForTesting
    Optional<HeronWorker> findLargestFittingWorker(AllocatedEvaluator evaluator,
                                                   Collection<HeronWorker> pendingWorkers,
                                                   boolean ignoreCpu) {
      ByteAmount allocatedRam
          = ByteAmount.fromMegabytes(evaluator.getEvaluatorDescriptor().getMemory());
      int allocatedCores = evaluator.getEvaluatorDescriptor().getNumberOfCores();
  
      HeronWorker biggestFittingWorker = null;
      for (HeronWorker worker : pendingWorkers) {
        if (worker.mem.greaterThan(allocatedRam)) {
          continue;
        }
  
        if (!ignoreCpu) {
          if (worker.cores > allocatedCores) {
            continue;
          }
        }
  
        if (biggestFittingWorker != null) {
          if (worker.mem.lessThan(biggestFittingWorker.mem)
              || worker.cores < biggestFittingWorker.cores) {
            continue;
          }
        }
        biggestFittingWorker = worker;
      }
  
      return Optional.fromNullable(biggestFittingWorker);
    }
docs: YARN allocates resources in fixed increments of memory and CPU. As a result, the actual
  resource allocation may be little more than what was requested. This method finds the biggest
  heron containerPlan that will fit the allocated YARN container. In some cases the YARN CPU
  scheduling may be disabled, resulting in default core allocation to each container. This
  method can ignore core fitting in such a case.