|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
| 15 | +from contextlib import AbstractContextManager |
15 | 16 | from types import TracebackType
|
16 | 17 | from typing import Dict, Mapping, Optional, Tuple, Type
|
17 | 18 | from typing_extensions import Literal, Self
|
18 | 19 |
|
19 |
| -from spinn_utilities.abstract_base import AbstractBase, abstractmethod |
| 20 | +from spinn_utilities.abstract_base import abstractmethod |
20 | 21 | from spinnman.constants import SCP_SCAMP_PORT
|
21 | 22 | from spinnman.transceiver.transceiver import Transceiver
|
22 | 23 | from spinnman.connections.udp_packet_connections import UDPConnection
|
|
27 | 28 | from .spalloc_scp_connection import SpallocSCPConnection
|
28 | 29 |
|
29 | 30 |
|
30 |
| -class SpallocJob(object, metaclass=AbstractBase): |
| 31 | +class SpallocJob(AbstractContextManager): |
31 | 32 | """
|
32 | 33 | Represents a job in Spalloc.
|
33 | 34 |
|
@@ -216,8 +217,9 @@ def __enter__(self) -> Self:
|
216 | 217 | """
|
217 | 218 | return self
|
218 | 219 |
|
219 |
| - def __exit__(self, exc_type: Optional[Type], exc_value: Exception, |
220 |
| - exc_tb: TracebackType) -> Literal[False]: |
| 220 | + def __exit__(self, exc_type: Optional[Type], |
| 221 | + exc_value: Optional[BaseException], |
| 222 | + exc_tb: Optional[TracebackType]) -> Literal[False]: |
221 | 223 | """
|
222 | 224 | Handle exceptions by killing the job and logging the exception in the
|
223 | 225 | job's destroy reason.
|
|
0 commit comments