command_executor.py 461 B

123456789101112131415161718192021222324
  1. from typing import Tuple
  2. from abc import ABC, abstractmethod
  3. class CommandExecutor(ABC):
  4. @abstractmethod
  5. def execute(self, cmd: str) -> Tuple[int, str]:
  6. pass
  7. @abstractmethod
  8. def execute_in_background(self, cmd: str):
  9. pass
  10. @abstractmethod
  11. def kill_background(self, id: int):
  12. pass
  13. @abstractmethod
  14. def read_logs(self, id: int) -> str:
  15. pass
  16. @abstractmethod
  17. def close(self):
  18. pass