Added HTTP control stuff
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -14,6 +14,10 @@ class ProgramExecutorStates(Enum):
|
||||
CRASHED = 4
|
||||
|
||||
|
||||
#
|
||||
# TODO: Put locks where they needed to be
|
||||
#
|
||||
|
||||
class ProgramExecutor(Thread):
|
||||
|
||||
def __init__(
|
||||
@@ -32,11 +36,13 @@ class ProgramExecutor(Thread):
|
||||
self._logger = logging.getLogger("executor")
|
||||
|
||||
def abort(self):
|
||||
# TODO: Na ide kellene locking
|
||||
self._logger.debug("Aborting due to external request...")
|
||||
self._state = ProgramExecutorStates.ABORTED
|
||||
self._program[self._pc].abort()
|
||||
|
||||
def get_status(self) -> dict:
|
||||
# TODO: evaluate data consistency and necessity of locking.
|
||||
return {
|
||||
"current_step": self._pc,
|
||||
"program_length": len(self._program),
|
||||
@@ -51,12 +57,16 @@ class ProgramExecutor(Thread):
|
||||
@property
|
||||
def state(self):
|
||||
# Used to check the successfulness of the run as well
|
||||
# Simple atomic read access no need to be locked
|
||||
return self._state
|
||||
|
||||
def stop_looping(self):
|
||||
# This only changes a boolean
|
||||
# Unprotected access won't cause problems
|
||||
if self._loop:
|
||||
self._logger.info("Looping disabled! Finishing current loop then exiting...")
|
||||
self._loop = False
|
||||
self._logger.info("Looping disabled! Finishing current loop then exiting...")
|
||||
|
||||
|
||||
def run(self) -> None:
|
||||
self._state = ProgramExecutorStates.RUNNING
|
||||
|
||||
Reference in New Issue
Block a user