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

Use a defaultdict for BlockInfo in htex scale-in #3300

Merged
merged 3 commits into from Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions parsl/executors/high_throughput/executor.py
@@ -1,4 +1,5 @@
import typing
from collections import defaultdict
from concurrent.futures import Future
import typeguard
import logging
Expand Down Expand Up @@ -730,13 +731,11 @@ class BlockInfo:
idle: float # shortest idle time of any manager in this block

managers = self.connected_managers()
block_info: Dict[str, BlockInfo] = {}
block_info: Dict[str, BlockInfo] = defaultdict(lambda: BlockInfo(tasks=0, idle=float('inf')))
for manager in managers:
if not manager['active']:
continue
b_id = manager['block_id']
if b_id not in block_info:
block_info[b_id] = BlockInfo(tasks=0, idle=float('inf'))
block_info[b_id].tasks += manager['tasks']
block_info[b_id].idle = min(block_info[b_id].idle, manager['idle_duration'])

Expand Down