run.py 492 B

123456789101112131415161718192021222324
  1. from dataclasses import dataclass
  2. from .base import Observation
  3. @dataclass
  4. class CmdOutputObservation(Observation):
  5. """
  6. This data class represents the output of a command.
  7. """
  8. command_id: int
  9. command: str
  10. exit_code: int = 0
  11. observation : str = "run"
  12. @property
  13. def error(self) -> bool:
  14. return self.exit_code != 0
  15. @property
  16. def message(self) -> str:
  17. return f'Command `{self.command}` executed with exit code {self.exit_code}.'