@@ -68,8 +68,8 @@ def __init__(self, *,
6868 self ._block_id_counter = AtomicIDCounter ()
6969
7070 self ._tasks = {} # type: Dict[object, Future]
71- self .blocks = {} # type: Dict[str, str]
72- self .block_mapping = {} # type: Dict[str, str]
71+ self .blocks_to_job_id = {} # type: Dict[str, str]
72+ self .job_ids_to_block = {} # type: Dict[str, str]
7373
7474 def _make_status_dict (self , block_ids : List [str ], status_list : List [JobStatus ]) -> Dict [str , JobStatus ]:
7575 """Given a list of block ids and a list of corresponding status strings,
@@ -194,8 +194,8 @@ def scale_out(self, blocks: int = 1) -> List[str]:
194194 logger .info (f"Allocated block ID { block_id } " )
195195 try :
196196 job_id = self ._launch_block (block_id )
197- self .blocks [block_id ] = job_id
198- self .block_mapping [job_id ] = block_id
197+ self .blocks_to_job_id [block_id ] = job_id
198+ self .job_ids_to_block [job_id ] = block_id
199199 block_ids .append (block_id )
200200 except Exception as ex :
201201 self ._fail_job_async (block_id ,
@@ -232,10 +232,10 @@ def _get_block_and_job_ids(self) -> Tuple[List[str], List[Any]]:
232232 # Not using self.blocks.keys() and self.blocks.values() simultaneously
233233 # The dictionary may be changed during invoking this function
234234 # As scale_in and scale_out are invoked in multiple threads
235- block_ids = list (self .blocks .keys ())
235+ block_ids = list (self .blocks_to_job_id .keys ())
236236 job_ids = [] # types: List[Any]
237237 for bid in block_ids :
238- job_ids .append (self .blocks [bid ])
238+ job_ids .append (self .blocks_to_job_id [bid ])
239239 return block_ids , job_ids
240240
241241 @abstractproperty
0 commit comments