Skip to content

Commit

Permalink
added possibility to check for empty drones, closes MatterMiners#92
Browse files Browse the repository at this point in the history
  • Loading branch information
eileen-kuehn authored and tfesenbecker committed May 7, 2020
1 parent 7f76d30 commit 90dd1b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lapis/drone.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(
ignore_resources: list = None,
sitename: str = None,
connection: Connection = None,
empty: callable = lambda drone: False,
):
"""
:param scheduler:
Expand Down Expand Up @@ -49,6 +50,10 @@ def __init__(
self._allocation = None
self._utilisation = None
self._job_queue = Queue()
self._empty = empty

def empty(self):
return self._empty(self)

# caching-related
self.jobs_with_cached_data = 0
Expand Down
2 changes: 2 additions & 0 deletions lapis/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ def cluster_groups(self) -> Iterator[List[Set[WrappedClassAd[Drone]]]]:
group = []
current_rank = None
for ranked_key, drones in self._clusters.items():
if next(iter(drones))._wrapped.empty():
continue
if ranked_key.rank != current_rank:
current_rank = ranked_key.rank
if group:
Expand Down

0 comments on commit 90dd1b4

Please sign in to comment.