From 8022866c75fa18ac757667aed7cd78437b2d5977 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Wed, 14 Aug 2024 09:22:44 -0700 Subject: [PATCH 1/3] Applies fix and assertions --- bittensor/metagraph.py | 4 ++++ tests/e2e_tests/subcommands/subnet/test_metagraph.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bittensor/metagraph.py b/bittensor/metagraph.py index 8d7e97bcc0..eb60ab7754 100644 --- a/bittensor/metagraph.py +++ b/bittensor/metagraph.py @@ -467,6 +467,7 @@ def state_dict(self): "bonds": self.bonds, "uids": self.uids, "axons": self.axons, + "neurons": self.neurons, } def sync( @@ -782,6 +783,7 @@ def save(self) -> "metagraph": # type: ignore graph_filename = f"{save_directory}/block-{self.block.item()}.pt" state_dict = self.state_dict() state_dict["axons"] = self.axons + state_dict["neurons"] = self.neurons torch.save(state_dict, graph_filename) state_dict = torch.load( graph_filename @@ -1029,6 +1031,7 @@ def load_from_path(self, dir_path: str) -> "metagraph": # type: ignore ) self.uids = torch.nn.Parameter(state_dict["uids"], requires_grad=False) self.axons = state_dict["axons"] + self.neurons = state_dict["neurons"] if "weights" in state_dict: self.weights = torch.nn.Parameter( state_dict["weights"], requires_grad=False @@ -1173,6 +1176,7 @@ def load_from_path(self, dir_path: str) -> "metagraph": # type: ignore self.last_update = state_dict["last_update"] self.validator_permit = state_dict["validator_permit"] self.axons = state_dict["axons"] + self.neurons = state_dict["neurons"] if "weights" in state_dict: self.weights = state_dict["weights"] if "bonds" in state_dict: diff --git a/tests/e2e_tests/subcommands/subnet/test_metagraph.py b/tests/e2e_tests/subcommands/subnet/test_metagraph.py index e8e18ef617..a77876c2bf 100644 --- a/tests/e2e_tests/subcommands/subnet/test_metagraph.py +++ b/tests/e2e_tests/subcommands/subnet/test_metagraph.py @@ -80,9 +80,8 @@ def test_metagraph_command(local_chain, capsys): captured = capsys.readouterr() # Assert the neuron is registered and displayed - assert ( - "Metagraph: net: local:1" and "N: 1/1" in captured.out - ), "Neuron isn't displayed in metagraph" + assert "Metagraph: net: local:1" in captured.out + assert "N: 1/1" in captured.out, "Neuron isn't displayed in metagraph" # Register Dave as neuron to the subnet dave_keypair, dave_exec_command, dave_wallet = setup_wallet("//Dave") @@ -117,6 +116,7 @@ def test_metagraph_command(local_chain, capsys): captured = capsys.readouterr() # Assert the neuron is registered and displayed - assert "Metagraph: net: local:1" and "N: 2/2" in captured.out + assert "Metagraph: net: local:1" in captured.out + assert "N: 2/2" in captured.out logging.info("Passed test_metagraph_command") From 96badebd8b13e18fc20b16f2db6bae777f0b27a9 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 15 Aug 2024 10:22:31 -0700 Subject: [PATCH 2/3] Debug commit --- tests/e2e_tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e_tests/conftest.py b/tests/e2e_tests/conftest.py index 4575ff298d..540a303f0f 100644 --- a/tests/e2e_tests/conftest.py +++ b/tests/e2e_tests/conftest.py @@ -34,8 +34,9 @@ def local_chain(request): # Check if param is None, and handle it accordingly args = "" if param is None else f"{param}" - # compile commands to send to process + # Compile commands to send to process cmds = shlex.split(f"{script_path} {args}") + # Start new node process process = subprocess.Popen( cmds, stdout=subprocess.PIPE, text=True, preexec_fn=os.setsid From 40512c897952c9bdff79ee2935776fc86291ce3a Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 15 Aug 2024 16:32:54 -0700 Subject: [PATCH 3/3] Dummy commit --- tests/e2e_tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e_tests/conftest.py b/tests/e2e_tests/conftest.py index 540a303f0f..3d8ab25b88 100644 --- a/tests/e2e_tests/conftest.py +++ b/tests/e2e_tests/conftest.py @@ -81,6 +81,6 @@ def wait_for_node_start(process, pattern): # Ensure the process has terminated process.wait() - # uninstall templates + # Uninstall templates logging.info("uninstalling neuron templates") uninstall_templates(template_path)