Source code for pacman.exceptions
# Copyright (c) 2014 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Any
[docs]
class PacmanException(Exception):
"""
Indicates a general exception from Pacman.
"""
[docs]
class PacmanInvalidParameterException(PacmanException):
"""
A parameter has an invalid value.
"""
def __init__(self, parameter: str, value: Any, problem: str):
"""
:param str parameter: The name of the parameter
:param str value: The value of the parameter
:param str problem: The problem with the value of the parameter
"""
super().__init__(problem)
self.parameter = parameter
self.value = value
[docs]
class PacmanAlreadyExistsException(PacmanException):
"""
Something already exists and that adding another would be a conflict.
"""
def __init__(self, item_type: str, item_id: Any):
"""
:param str item_type: The type of the item that already exists
:param str item_id: The ID of the item which is in conflict
"""
super().__init__(f"{item_type}({item_id}) already exists")
self.item_type = item_type
self.item_id = item_id
[docs]
class PacmanPartitionException(PacmanException):
"""
Something went wrong with partitioning.
"""
[docs]
class PacmanPlaceException(PacmanException):
"""
Something went wrong with placement.
"""
[docs]
class PacmanTooBigToPlace(PacmanException):
"""
A request by a splitter to put some vertices on a single chip cannot be
satisfied; not enough space is available.
"""
[docs]
class PacmanPruneException(PacmanException):
"""
Something went wrong with pruning.
"""
[docs]
class PacmanRouteInfoAllocationException(PacmanException):
"""
Something went wrong with route info allocation.
"""
[docs]
class PacmanElementAllocationException(PacmanException):
"""
Something went wrong with element allocation.
"""
[docs]
class PacmanRoutingException(PacmanException):
"""
Something went wrong with routing.
"""
[docs]
class PacmanConfigurationException(PacmanException):
"""
Something went wrong with configuring some part of PACMAN.
"""
[docs]
class PacmanNotExistException(PacmanException):
"""
A routing table entry was attempted
to be removed from a routing table which didn't have such an entry.
"""
[docs]
class PacmanExternalAlgorithmFailedToCompleteException(PacmanException):
"""
An algorithm ran from outside
the software stack has failed to complete for some unknown reason.
"""
[docs]
class PacmanAlgorithmFailedToGenerateOutputsException(PacmanException):
"""
An algorithm has not generated the correct outputs for some unknown reason.
"""
[docs]
class PacmanAlreadyPlacedError(ValueError):
"""
Multiple placements are being made for a vertex.
"""
[docs]
class PacmanNotPlacedError(KeyError):
"""
No placements are made for a vertex.
"""
[docs]
class PacmanProcessorAlreadyOccupiedError(ValueError):
"""
Multiple placements are being made to a processor.
"""
[docs]
class PacmanProcessorNotOccupiedError(KeyError):
"""
No placement has been made to a processor.
"""
[docs]
class PacmanValueError(ValueError, PacmanException):
"""
A value is invalid for some reason.
"""
[docs]
class PacmanNotFoundError(KeyError, PacmanException):
"""
Some object has not been found when requested.
"""
[docs]
class PacmanTypeError(TypeError, PacmanException):
"""
An object is of incorrect type.
"""
[docs]
class PacmanNoMergeException(PacmanException):
"""
There are no merges worth performing.
"""
[docs]
class PacmanCanNotFindChipException(PacmanException):
"""
The chip was not in the list of chips.
"""
[docs]
class MachineHasDisconnectedSubRegion(PacmanException):
"""
Some part of the machine has no paths connecting it to the rest of the
machine.
"""
[docs]
class SDRAMEdgeSizeException(PacmanException):
"""
A constant SDRAM partition has discovered its edges have
inconsistent size requests.
"""
[docs]
class PartitionMissingEdgesException(PacmanException):
"""
After partitioning, a partition does not have the edges it expects.
"""
[docs]
class MinimisationFailedError(PacmanException):
"""
A routing table could not be minimised to reach a specified target.
"""