Skip to content

Commit

Permalink
added possibility to check for empty drones, closes #92
Browse files Browse the repository at this point in the history
  • Loading branch information
eileen-kuehn authored and tfesenbecker committed Feb 24, 2020
1 parent 89cf6ba commit 0ec40af
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 @@ -21,6 +21,7 @@ def __init__(
ignore_resources: list = None,
sitename: str = None,
connection: Connection = None,
empty: callable = lambda drone: False,
):
"""
:param scheduler:
Expand Down Expand Up @@ -50,6 +51,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 0ec40af

Please sign in to comment.