Skip to content

Commit

Permalink
do not do the entire loop but only until "n"
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Apr 22, 2020
1 parent 61525c0 commit 473dd42
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions adaptive/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ def do_log(self):
return self.log is not None

def _ask(self, n):
pids = [
pid
for pid in self._to_retry.keys()
if pid not in self._pending_points.values()
][:n]
pending_ids = self._pending_points.values()
pids_gen = (pid for pid in self._to_retry.keys() if pid not in pending_ids)
pids = list(itertools.islice(pids_gen, n))

loss_improvements = len(pids) * [float("inf")]

if len(pids) < n:
Expand Down

0 comments on commit 473dd42

Please sign in to comment.