Skip to content

Commit

Permalink
Merge pull request #528 from SpiNNakerManchester/governed_app_vertex_…
Browse files Browse the repository at this point in the history
…never_none

when governed_app_vertex is requested it is no loner None
  • Loading branch information
Christian-B committed Oct 25, 2023
2 parents 0614953 + 4df4443 commit c962251
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pacman/model/partitioner_splitters/abstract_splitter_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class AbstractSplitterCommon(object, metaclass=AbstractBase):

__slots__ = [
# the app vertex this splitter governs.
"_governed_app_vertex",
"__governed_app_vertex",
]

def __init__(self):
self._governed_app_vertex = None
self.__governed_app_vertex = None

def __str__(self):
try:
return (
f"{type(self).__name__} on {self._governed_app_vertex.label}")
f"{type(self).__name__} on {self.__governed_app_vertex.label}")
except AttributeError:
return f"{type(self).__name__} has no governed_app_vertex"

Expand All @@ -46,7 +46,10 @@ def governed_app_vertex(self):
:rtype: ~pacman.model.graphs.application.ApplicationVertex
"""
return self._governed_app_vertex
if self.__governed_app_vertex is None:
raise PacmanConfigurationException(
"This splitter has no governing app vertex set")
return self.__governed_app_vertex

def set_governed_app_vertex(self, app_vertex):
"""
Expand All @@ -58,13 +61,13 @@ def set_governed_app_vertex(self, app_vertex):
:raises PacmanConfigurationException:
if the app vertex has already been set.
"""
if self._governed_app_vertex == app_vertex:
if self.__governed_app_vertex == app_vertex:
return
if self._governed_app_vertex is not None:
if self.__governed_app_vertex is not None:
raise PacmanConfigurationException(
f"The app vertex {self._governed_app_vertex} is already"
f"The app vertex {self.__governed_app_vertex} is already"
f" governed by this splitter. ")
self._governed_app_vertex = app_vertex
self.__governed_app_vertex = app_vertex
app_vertex.splitter = self

@abstractmethod
Expand Down Expand Up @@ -178,7 +181,7 @@ def get_same_chip_groups(self):
~pacman.model.resources.AbstractSDRAM)
"""
return [([v], v.sdram_required)
for v in self._governed_app_vertex.machine_vertices]
for v in self.__governed_app_vertex.machine_vertices]

def get_internal_multicast_partitions(self):
"""
Expand Down

0 comments on commit c962251

Please sign in to comment.