Skip to content

Commit 17da107

Browse files
committed
use a defaultdict for blockinfo, which arose in review of PR #3232
this is to accomodate future population of blockinfo from multiple sources how is this change tested? it *shouldn't* change anything. but scale_in is not well tested...
1 parent 9affe8e commit 17da107

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

parsl/executors/high_throughput/executor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import typing
2+
from collections import defaultdict
23
from concurrent.futures import Future
34
import typeguard
45
import logging
@@ -730,13 +731,11 @@ class BlockInfo:
730731
idle: float # shortest idle time of any manager in this block
731732

732733
managers = self.connected_managers()
733-
block_info: Dict[str, BlockInfo] = {}
734+
block_info: Dict[str, BlockInfo] = defaultdict(lambda: BlockInfo(tasks=0, idle=float('inf')))
734735
for manager in managers:
735736
if not manager['active']:
736737
continue
737738
b_id = manager['block_id']
738-
if b_id not in block_info:
739-
block_info[b_id] = BlockInfo(tasks=0, idle=float('inf'))
740739
block_info[b_id].tasks += manager['tasks']
741740
block_info[b_id].idle = min(block_info[b_id].idle, manager['idle_duration'])
742741

0 commit comments

Comments
 (0)