diff --git a/pacman/data/pacman_data_view.py b/pacman/data/pacman_data_view.py index a24ef6111..23cd17f51 100644 --- a/pacman/data/pacman_data_view.py +++ b/pacman/data/pacman_data_view.py @@ -48,12 +48,12 @@ class _PacmanDataModel(object): "_machine_graph", "_machine_partition_n_keys_map", "_placements", - "_precompressed_router_tables", - "_uncompressed_router_tables", + "_precompressed", "_routing_infos", "_runtime_graph", "_runtime_machine_graph", - "_tags" + "_tags", + "_uncompressed" ] def __new__(cls): @@ -78,8 +78,8 @@ def _hard_reset(self): Clears out all data that should change after a reset and graaph change """ self._placements = None - self._precompressed_router_tables = None - self._uncompressed_router_tables = None + self._precompressed = None + self._uncompressed = None self._runtime_graph = None self._runtime_machine_graph = None self._routing_infos = None @@ -379,13 +379,13 @@ def get_machine_partition_n_keys_map(cls): # RoutingTables @classmethod - def get_uncompressed_router_tables(cls): - if cls.__pacman_data._uncompressed_router_tables is None: + def get_uncompressed(cls): + if cls.__pacman_data._uncompressed is None: raise cls._exception("router_tables") - return cls.__pacman_data._uncompressed_router_tables + return cls.__pacman_data._uncompressed @classmethod - def get_precompressed_router_tables(cls): - if cls.__pacman_data._precompressed_router_tables is None: + def get_precompressed(cls): + if cls.__pacman_data._precompressed is None: raise cls._exception("precompressed_router_tables") - return cls.__pacman_data._precompressed_router_tables + return cls.__pacman_data._precompressed diff --git a/pacman/data/pacman_data_writer.py b/pacman/data/pacman_data_writer.py index 8e1d016e5..2a3b3235f 100644 --- a/pacman/data/pacman_data_writer.py +++ b/pacman/data/pacman_data_writer.py @@ -180,24 +180,24 @@ def set_machine_partition_n_keys_map(self, machine_partition_n_keys_map): self.__pacman_data._machine_partition_n_keys_map = \ machine_partition_n_keys_map - def set_uncompressed_router_tables(self, router_tables): + def set_uncompressed(self, router_tables): """ - Sets the router_tables value + Sets the uncompressed router_tables value :param MulticastRoutingTables router_tables: new value """ if not isinstance(router_tables, MulticastRoutingTables): raise TypeError( "router_tables should be a MulticastRoutingTables") - self.__pacman_data._uncompressed_router_tables = router_tables + self.__pacman_data._uncompressed = router_tables - def set_precompressed_router_tables(self, router_tables): + def set_precompressed(self, router_tables): """ - Sets the router_tables value + Sets the precompressed router_tables value :param MulticastRoutingTables router_tables: new value """ if not isinstance(router_tables, MulticastRoutingTables): raise TypeError( "router_tables should be a MulticastRoutingTables") - self.__pacman_data._precompressed_router_tables = router_tables + self.__pacman_data._precompressed = router_tables diff --git a/pacman/operations/router_compressors/abstract_compressor.py b/pacman/operations/router_compressors/abstract_compressor.py index 8e993270f..12e86a5af 100644 --- a/pacman/operations/router_compressors/abstract_compressor.py +++ b/pacman/operations/router_compressors/abstract_compressor.py @@ -50,7 +50,7 @@ def _run(self): """ :rtype: MulticastRoutingTables """ - router_tables = PacmanDataView.get_precompressed_router_tables() + router_tables = PacmanDataView.get_precompressed() # create progress bar progress = ProgressBar( router_tables.routing_tables, diff --git a/pacman/operations/router_compressors/ranged_compressor.py b/pacman/operations/router_compressors/ranged_compressor.py index 9109691ae..df2398822 100644 --- a/pacman/operations/router_compressors/ranged_compressor.py +++ b/pacman/operations/router_compressors/ranged_compressor.py @@ -40,7 +40,7 @@ def range_compressor(accept_overflow=True): message = "Precompressing tables using Range Compressor" else: message = "Compressing tables using Range Compressor" - router_tables = PacmanDataView.get_uncompressed_router_tables() + router_tables = PacmanDataView.get_uncompressed() progress = ProgressBar(len(router_tables.routing_tables), message) compressor = RangeCompressor() compressed_tables = MulticastRoutingTables() diff --git a/pacman_integration_tests/manual_runner.py b/pacman_integration_tests/manual_runner.py index 8480f8e5e..630f63eaa 100644 --- a/pacman_integration_tests/manual_runner.py +++ b/pacman_integration_tests/manual_runner.py @@ -59,7 +59,7 @@ # Hack to stop it throwing a wobly for too many entries Machine.ROUTER_ENTRIES = 50000 set_config("Mapping", "router_table_compress_as_far_as_possible", True) -PacmanDataWriter.mock().set_uncompressed_router_tables(original_tables) +PacmanDataWriter.mock().set_uncompressed(original_tables) if MUNDY: start = time.time() @@ -72,7 +72,7 @@ pair_tables = pair_compressor() pair_time = time.time() if MUNDY and PRE: - PacmanDataWriter.mock().set_uncompressed_router_tables(pre_tables) + PacmanDataWriter.mock().set_uncompressed(pre_tables) both_tables = ordered_covering_compressor() both_time = time.time() for original in original_tables: diff --git a/unittests/data/test_data.py b/unittests/data/test_data.py index 85941006e..f0968fa80 100644 --- a/unittests/data/test_data.py +++ b/unittests/data/test_data.py @@ -208,23 +208,23 @@ def test_router_tables(self): table = MulticastRoutingTables() writer = PacmanDataWriter.setup() with self.assertRaises(DataNotYetAvialable): - PacmanDataView.get_uncompressed_router_tables() - writer.set_uncompressed_router_tables(table) - self.assertEqual(table, PacmanDataView.get_uncompressed_router_tables()) + PacmanDataView.get_uncompressed() + writer.set_uncompressed(table) + self.assertEqual(table, PacmanDataView.get_uncompressed()) with self.assertRaises(DataNotYetAvialable): - PacmanDataView.get_precompressed_router_tables() + PacmanDataView.get_precompressed() with self.assertRaises(TypeError): - writer.set_uncompressed_router_tables("Bacon") + writer.set_uncompressed("Bacon") def test_precompressed_router_tables(self): table = MulticastRoutingTables() writer = PacmanDataWriter.setup() with self.assertRaises(DataNotYetAvialable): - PacmanDataView.get_precompressed_router_tables() - writer.set_precompressed_router_tables(table) + PacmanDataView.get_precompressed() + writer.set_precompressed(table) self.assertEqual( - table, PacmanDataView.get_precompressed_router_tables()) + table, PacmanDataView.get_precompressed()) with self.assertRaises(DataNotYetAvialable): - PacmanDataView.get_uncompressed_router_tables() + PacmanDataView.get_uncompressed() with self.assertRaises(TypeError): - writer.set_precompressed_router_tables() + writer.set_precompressed() diff --git a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index 0a04a24b2..bff07373f 100644 --- a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py @@ -36,7 +36,7 @@ def test_onordered_pair_big(self): j_router = os.path.join(path, "many_to_one.json.gz") original_tables = from_json(j_router) - PacmanDataWriter.mock().set_precompressed_router_tables(original_tables) + PacmanDataWriter.mock().set_precompressed(original_tables) with self.assertRaises(PacmanElementAllocationException): pair_compressor( ordered=False, accept_overflow=False, verify=True) diff --git a/unittests/operations_tests/router_compressor_tests/test_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index 11357d686..2cec42228 100644 --- a/unittests/operations_tests/router_compressor_tests/test_compressors.py +++ b/unittests/operations_tests/router_compressor_tests/test_compressors.py @@ -55,11 +55,11 @@ def setUp(self): set_config( "Mapping", "router_table_compress_as_far_as_possible", True) writer = PacmanDataWriter.mock() - writer.set_uncompressed_router_tables(original_tables) - writer.set_precompressed_router_tables(original_tables) + writer.set_uncompressed(original_tables) + writer.set_precompressed(original_tables) def check_compression(self, compressed_tables): - for original in PacmanDataView.get_precompressed_router_tables(): + for original in PacmanDataView.get_precompressed(): compressed = compressed_tables.get_routing_table_for_chip( original.x, original.y) assert compressed.number_of_entries < original.number_of_entries @@ -71,7 +71,7 @@ def test_pair_compressor(self): def test_range_compressor_skipped(self): compressed_tables = range_compressor() - for original in PacmanDataView.get_uncompressed_router_tables(): + for original in PacmanDataView.get_uncompressed(): compressed = compressed_tables.get_routing_table_for_chip( original.x, original.y) self.assertEqual(original, compressed) diff --git a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py index 28204698a..c69228515 100644 --- a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py @@ -37,7 +37,7 @@ def test_oc_big(self): j_router = os.path.join(path, "many_to_one.json.gz") original_tables = from_json(j_router) - PacmanDataWriter.mock().set_precompressed_router_tables( + PacmanDataWriter.mock().set_precompressed( original_tables) compressed_tables = ordered_covering_compressor() diff --git a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py index 4fc261855..a337286f9 100644 --- a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py @@ -35,7 +35,7 @@ def test_pair_big(self): path = os.path.dirname(os.path.abspath(class_file)) j_router = os.path.join(path, "many_to_one.json.gz") original_tables = from_json(j_router) - PacmanDataWriter.mock().set_precompressed_router_tables( + PacmanDataWriter.mock().set_precompressed( original_tables) compressed_tables = pair_compressor() diff --git a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py index a3bc1b575..d89b2dc3d 100644 --- a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py +++ b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py @@ -49,7 +49,7 @@ def test_tables(self): table_path = os.path.join(path, "table2.csv.gz") table = from_csv(table_path) tables.add_routing_table(table) - PacmanDataWriter.mock().set_uncompressed_router_tables(tables) + PacmanDataWriter.mock().set_uncompressed(tables) compressed = range_compressor() c_table = compressed.get_routing_table_for_chip(0, 0) compare_tables(table, c_table) diff --git a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py index 88f57dad5..07e0f931e 100644 --- a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py @@ -36,7 +36,7 @@ def test_onordered_pair_big(self): path = os.path.dirname(os.path.abspath(class_file)) j_router = os.path.join(path, "many_to_one.json.gz") original_tables = from_json(j_router) - PacmanDataWriter.mock().set_precompressed_router_tables( + PacmanDataWriter.mock().set_precompressed( original_tables) # Hack to stop it throwing a wobly for too many entries