diff --git a/.gitignore b/.gitignore index 2865c03..c8100f6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ **/results*.npy c_models/Debug/ c_models/Release/ +/.mypy_cache/ +/.pytest_cache/ diff --git a/mcmc/mcmc_coordinator_vertex.py b/mcmc/mcmc_coordinator_vertex.py index 6e42ba0..04e3bf6 100644 --- a/mcmc/mcmc_coordinator_vertex.py +++ b/mcmc/mcmc_coordinator_vertex.py @@ -156,7 +156,7 @@ def get_data_window_size(self, placement): def get_sequence_mask(self, placement, routing_info): if self._is_receiver_placement(placement): - mask = routing_info.get_routing_info_from_pre_vertex( + mask = routing_info.get_safe_routing_info_from_pre_vertex( self, self._data_partition_name).mask return ~mask & 0xFFFFFFFF return 0 @@ -239,17 +239,16 @@ def generate_data_specification( spec.write_value(len(keys), data_type=DataType.UINT32) # Write the key - vertex_routing_info = routing_info.get_routing_info_from_pre_vertex( + vtx_routing_info = routing_info.get_safe_routing_info_from_pre_vertex( self, self._data_partition_name) - assert vertex_routing_info is not None - spec.write_value(vertex_routing_info.key, data_type=DataType.UINT32) + spec.write_value(vtx_routing_info.key, data_type=DataType.UINT32) # Write the window size spec.write_value(self._window_size, data_type=DataType.UINT32) # Write the sequence mask spec.write_value( - ~vertex_routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32) + ~vtx_routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32) # Write the timer spec.write_value(self._send_timer, data_type=DataType.UINT32) diff --git a/mcmc/mcmc_vertex.py b/mcmc/mcmc_vertex.py index 5a4f3ec..14ae52f 100644 --- a/mcmc/mcmc_vertex.py +++ b/mcmc/mcmc_vertex.py @@ -259,19 +259,17 @@ def generate_data_specification( spec.write_value(self._coordinator.acknowledge_timer) # Write the (first) key for sending parameter data, if needed - if (self._model.root_finder): - routing_info_rf = routing_info.get_routing_info_from_pre_vertex( + if self._model.root_finder: + rinfo_rf = routing_info.get_safe_routing_info_from_pre_vertex( self, self._parameter_partition_name) - assert routing_info_rf is not None - spec.write_value(routing_info_rf.key, data_type=DataType.UINT32) + spec.write_value(rinfo_rf.key, data_type=DataType.UINT32) else: spec.write_value(0, data_type=DataType.UINT32) - if (self._model.cholesky): - routing_info_ch = routing_info.get_routing_info_from_pre_vertex( + if self._model.cholesky: + rinfo_ch = routing_info.get_safe_routing_info_from_pre_vertex( self, self._cholesky_partition_name) - assert routing_info_ch is not None - spec.write_value(routing_info_ch.key, data_type=DataType.UINT32) + spec.write_value(rinfo_ch.key, data_type=DataType.UINT32) else: spec.write_value(0, data_type=DataType.UINT32)