Skip to content

Commit

Permalink
Make process inherit __enter__ from AbstractContextManager rather tha…
Browse files Browse the repository at this point in the history
…n redefining it.
  • Loading branch information
Gavinator98 committed Feb 15, 2023
1 parent 26e7d3d commit 2af0ee7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lava/magma/core/process/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import typing as ty
from _collections import OrderedDict
from dataclasses import dataclass
from contextlib import AbstractContextManager
from lava.magma.compiler.executable import Executable

from lava.magma.core.process.interfaces import \
Expand Down Expand Up @@ -35,7 +36,7 @@ def __call__(cls, *args, **kwargs):
return obj


class AbstractProcess(metaclass=ProcessPostInitCaller):
class AbstractProcess(AbstractContextManager, metaclass=ProcessPostInitCaller):
"""The notion of a Process is inspired by the Communicating Sequential
Process paradigm for distributed, parallel, and asynchronous programming.
Expand Down Expand Up @@ -221,10 +222,6 @@ def __del__(self):
"""
self.stop()

def __enter__(self):
"""Required for "with" block."""
pass

def __exit__(self, exc_type, exc_val, exc_tb):
"""Stop the runtime when exiting "with" block of a context manager."""
self.stop()
Expand Down

0 comments on commit 2af0ee7

Please sign in to comment.