Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix division by zero in scheduling code #774

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions lib/pavilion/schedulers/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,18 +336,22 @@ def _get_chunks(self, node_list_id, sched_config) -> List[NodeSet]:
for node in include_nodes:
if node in nodes:
nodes.remove(node)
chunk_size = chunk_size - len(include_nodes)

chunks = []
for i in range(len(nodes)//chunk_size):
# Apply the selection function and get our chunk nodes.
chunk = self.NODE_SELECTION[node_select](nodes, chunk_size)
# Filter out any chosen from our node list.
nodes = [node for node in nodes if node not in chunk]

# Add the 'include_nodes' to every chunk.
chunk = include_nodes + chunk
chunks.append(chunk)

if len(nodes) == chunk_size:
chunks = include_nodes
else:
chunk_size = chunk_size - len(include_nodes)
chunks = []

for i in range(len(nodes)//chunk_size):
# Apply the selection function and get our chunk nodes.
chunk = self.NODE_SELECTION[node_select](nodes, chunk_size)
# Filter out any chosen from our node list.
nodes = [node for node in nodes if node not in chunk]

# Add the 'include_nodes' to every chunk.
chunk = include_nodes + chunk
chunks.append(chunk)

if nodes and chunk_extra == BACKFILL:
backfill = chunks[-1][:chunk_size - len(nodes)]
Expand Down
Loading