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 9, 2020
1 parent e1c9d4c commit dd199d3
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 @@ -22,6 +22,7 @@ def __init__(
ignore_resources: list = None,
sitename: str = None,
connection: Connection = None,
empty: callable = lambda drone: False,
):
"""
:param scheduler:
Expand Down Expand Up @@ -51,6 +52,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 @@ -483,6 +483,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 dd199d3

Please sign in to comment.