diff --git a/src/core/pyros_django/agent/Agent.py b/src/core/pyros_django/agent/Agent.py index 6bb7b1a..1c9bbe6 100755 --- a/src/core/pyros_django/agent/Agent.py +++ b/src/core/pyros_django/agent/Agent.py @@ -1003,6 +1003,7 @@ class Agent: elif cmd.name in ("flush_commands"): self.print("flush_commands received: Delete all pending commands") Command.delete_pending_commands_for_agent(self.name) + cmd.set_result('DONE') elif cmd.name in ("abort", "exit", "restart_init"): #self.printd("Current pending commands are:") #Command.show_commands(self._pending_commands) @@ -1013,6 +1014,7 @@ class Agent: self.DO_RESTART=True elif cmd.name == "exit": self.DO_EXIT=True + cmd.set_result('SHOULD BE DONE NOW') else: name = cmd.name args = None @@ -1235,6 +1237,7 @@ class Agent: #cmdts_res = None def simulator_test_results(self): + if self.SIMULATOR_COMMANDS_LIST == [] : return commands = self.simulator_test_results_start() nb_asserted = self.simulator_test_results_main(commands) self.simulator_test_results_end(nb_asserted) diff --git a/src/core/pyros_django/agent/AgentDevice.py b/src/core/pyros_django/agent/AgentDevice.py index 2fd9fac..afe96a5 100755 --- a/src/core/pyros_django/agent/AgentDevice.py +++ b/src/core/pyros_django/agent/AgentDevice.py @@ -224,45 +224,7 @@ class AgentDevice(Agent): super().exec_specific_cmd_end(cmd, from_thread) ''' - # @override - def simulator_test_results_main(self, commands): - nb_asserted = 0 - for cmd in commands: - if cmd.name == "flush_commands": - assert cmd.is_executed() - nb_asserted+=1 - # 2 times - if cmd.name == "go_active": - assert cmd.is_executed() - nb_asserted+=1 - # 2 times - if cmd.name == "go_idle": - assert cmd.is_executed() - nb_asserted+=1 - """ - if cmd.name == "specific0": - assert cmd.is_skipped() - assert cmd.result == "in step #5/5" - nb_asserted+=1 - """ - if cmd.name == "specific1": - assert cmd.is_killed() - nb_asserted+=1 - if cmd.name == "specific2": - assert cmd.is_executed() - assert cmd.result == "in step #5/5" - nb_asserted+=1 - if cmd.name == "eval 4+3": - assert cmd.is_executed() - assert cmd.get_result() == "7" - nb_asserted+=1 - if cmd.name in ("abort"): - assert cmd.is_executed() - nb_asserted+=1 - if cmd.name in ("exit"): - assert cmd.is_executed() - nb_asserted+=1 - return nb_asserted + """ diff --git a/src/core/pyros_django/agent/AgentDeviceTelescopeGemini.py b/src/core/pyros_django/agent/AgentDeviceTelescopeGemini.py index 0cc12bd..36ec170 100755 --- a/src/core/pyros_django/agent/AgentDeviceTelescopeGemini.py +++ b/src/core/pyros_django/agent/AgentDeviceTelescopeGemini.py @@ -24,14 +24,14 @@ class AgentDeviceTelescopeGemini(AgentDevice): # Run this agent in simulator mode SIMULATOR_MODE = False # Run the assertion tests at the end - SIMULATOR_WITH_TEST = False + SIMULATOR_WITH_TEST = True #SIMULATOR_MAX_DURATION_SEC = None SIMULATOR_MAX_DURATION_SEC = 100 # Who should I send commands to ? #SIMULATOR_COMMANDS_DEST = "myself" ##SIMULATOR_COMMANDS_DEST = "AgentB" # Scenario to be executed - ##SIMULATOR_COMMANDS_LIST = [] + SIMULATOR_COMMANDS_LIST = [] @@ -101,21 +101,21 @@ class AgentDeviceTelescopeGemini(AgentDevice): cmd="get date" res = self._device_ctrl.execute_cmd(cmd) - print("result is", str(res)) + self.printd("result is", str(res)) if res.ok: print("OK") dev_date = str(res) time.sleep(1) cmd="get time" res = self._device_ctrl.execute_cmd(cmd) - print("result is", str(res)) + self.printd("result is", str(res)) if res.ok: print("OK") dev_time = str(res) time.sleep(1) cmd="get radec" res = self._device_ctrl.execute_cmd(cmd) - print("result is", str(res)) + self.printd("result is", str(res)) if res.ok: print("OK") dev_radec = str(res) time.sleep(1) @@ -124,53 +124,6 @@ class AgentDeviceTelescopeGemini(AgentDevice): - """ - ================================================================= - FUNCTIONS RUN INSIDE A SUB-THREAD (OR A PROCESS) (thread_*()) - ================================================================= - """ - - - # @override - def simulator_test_results_main(self, commands): - nb_asserted = 0 - for cmd in commands: - if cmd.name == "flush_commands": - assert cmd.is_executed() - nb_asserted+=1 - # 2 times - if cmd.name == "go_active": - assert cmd.is_executed() - nb_asserted+=1 - # 2 times - if cmd.name == "go_idle": - assert cmd.is_executed() - nb_asserted+=1 - """ - if cmd.name == "specific0": - assert cmd.is_skipped() - assert cmd.result == "in step #5/5" - nb_asserted+=1 - """ - if cmd.name == "specific1": - assert cmd.is_killed() - nb_asserted+=1 - if cmd.name == "specific2": - assert cmd.is_executed() - assert cmd.result == "in step #5/5" - nb_asserted+=1 - if cmd.name == "eval 4+3": - assert cmd.is_executed() - assert cmd.get_result() == "7" - nb_asserted+=1 - if cmd.name in ("abort"): - assert cmd.is_executed() - nb_asserted+=1 - if cmd.name in ("exit"): - assert cmd.is_executed() - nb_asserted+=1 - return nb_asserted - """ ================================================================= diff --git a/src/core/pyros_django/agent/AgentTelescopeRequester.py b/src/core/pyros_django/agent/AgentTelescopeRequester.py index 25a91d0..9648f50 100755 --- a/src/core/pyros_django/agent/AgentTelescopeRequester.py +++ b/src/core/pyros_django/agent/AgentTelescopeRequester.py @@ -19,7 +19,7 @@ class AgentTelescopeRequester(Agent): # Run this agent in simulator mode SIMULATOR_MODE = True # Run the assertion tests at the end - SIMULATOR_WITH_TEST = False + SIMULATOR_WITH_TEST = True #SIMULATOR_MAX_DURATION_SEC = None SIMULATOR_MAX_DURATION_SEC = 100 # Who should I send commands to ? @@ -195,12 +195,15 @@ class AgentTelescopeRequester(Agent): if cmd.name == "go_idle": assert cmd.is_executed() nb_asserted+=1 + if cmd.name == "get radec": + assert cmd.is_executed() + #assert cmd.result == "06:10:38,+89:41:02" + nb_asserted+=1 """ if cmd.name == "specific0": assert cmd.is_skipped() assert cmd.result == "in step #5/5" nb_asserted+=1 - """ if cmd.name == "specific1": assert cmd.is_killed() nb_asserted+=1 @@ -215,6 +218,7 @@ class AgentTelescopeRequester(Agent): if cmd.name in ("abort"): assert cmd.is_executed() nb_asserted+=1 + """ if cmd.name in ("exit"): assert cmd.is_executed() nb_asserted+=1 diff --git a/src/core/pyros_django/agent/logpyros.py b/src/core/pyros_django/agent/logpyros.py index d3c3b39..575f3a7 100644 --- a/src/core/pyros_django/agent/logpyros.py +++ b/src/core/pyros_django/agent/logpyros.py @@ -15,15 +15,13 @@ import src.core.celme as celme class LogPyros: """ - Manage PyROS logs in display, file and database. - + First, create an instance: log = LogPyros("test",None) Second, use the print methods to log: log.print("Something to log") - """ # === Level of log -- libgit2 0.21.2