def _greedy(self, rdesc):
        # Get total_cpus from each allocator.
        for host in self.cluster:
            if host.total_cpus <= 0:
                count, criteria = host.allocator.max_servers({})
                host.total_cpus = count

        # Select first machine found with an (assumed) idle cpu.
        for host in self.cluster:
            if host.allocated_cpus < host.total_cpus:
                allocation_host = host
                break
        else:  # No idle cpus.
            return (-1, {'min_cpus': 'no idle cpus'})

        # Generate hostnames starting at selected machine.
        hostnames = []
        min_cpus = rdesc.get('min_cpus', 1)
        required = min_cpus
        for host in self.cluster:
            if host.allocated_cpus < host.total_cpus:
                count = host.total_cpus - host.allocated_cpus
                count = min(count, required)
                for i in range(count):
                    hostnames.append(host.netname)
                required -= count
                if required <= 0:
                    break
        else:  # Insufficient idle cpus.
            return (-1, {'min_cpus': 'want %d, idle %d' \
                                     % (min_cpus, len(hostnames))})

        return (0, {'host': allocation_host, 'hostnames': hostnames})
'time estimate' using greedy selection.
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/resource.py/ClusterAllocator._greedy