diff --git a/src/core/pyros_django/agent/Agent.py b/src/core/pyros_django/agent/Agent.py index 63470be..f208e9f 100755 --- a/src/core/pyros_django/agent/Agent.py +++ b/src/core/pyros_django/agent/Agent.py @@ -648,7 +648,7 @@ class Agent: # CASE 1 - AGENT LEVEL command # => I process it directly without asking my DC # => Simple action, short execution time, so I execute it directly (in current main thread, not in parallel) - if self._is_agent_level_cmd(cmd): + if self.is_agent_level_cmd(cmd): print("********** AGENT LEVEL CMD *********") try: self._exec_agent_cmd(cmd) @@ -1181,8 +1181,8 @@ class Agent: else: return getattr(self, func)() - def _is_agent_level_cmd(self, cmd:Command): - return cmd.is_agent_level_general_cmd() or self._is_agent_level_specific_cmd(cmd) + def is_agent_level_cmd(self, cmd:Command): + return cmd.is_agent_general_cmd() or self._is_agent_specific_cmd(cmd) ''' def _exec_agent_cmd(self, cmd:Command): @@ -1374,11 +1374,14 @@ class Agent: assert last_cmd.get_result() == "SHOULD BE DONE NOW" nb_asserted = 0 + nb_agent_general = 0 nb_unknown = 0 nb_unimplemented = 0 for cmd in commands: assert cmd.is_executed() or cmd.is_killed() or cmd.is_skipped() nb_asserted += 1 + if cmd.is_agent_general_cmd(): + nb_agent_general += 1 if cmd.name == "do_unknown": assert cmd.is_skipped() #assert "UnimplementedGenericCmdException" in cmd.get_result() @@ -1389,8 +1392,12 @@ class Agent: assert cmd.is_skipped() assert "UnimplementedGenericCmdException" in cmd.get_result() nb_unimplemented += 1 + assert nb_commands_to_send == nb_asserted print(nb_commands_to_send, "cmds I had to send <==>", nb_asserted, "cmds executed (or killed)") - print("Among them,", nb_unimplemented, "unimplemented command(s) and", nb_unknown, "unknown command(s) ==> UnimplementedGenericCmdException raised then command was skipped") + print("Among them:") + print(f"- {nb_agent_general} AGENT general command(s)") + print("-", nb_unimplemented, "unimplemented command(s) => UnimplementedGenericCmdException raised then command was skipped") + print("-", nb_unknown, "unknown command(s) => skipped") assert nb_asserted == nb_commands_to_send # Specific (detailed) test (to be overriden by subclass) diff --git a/src/core/pyros_django/agent/AgentDeviceSBIG.py b/src/core/pyros_django/agent/AgentDeviceSBIG.py index 3f45364..403895f 100755 --- a/src/core/pyros_django/agent/AgentDeviceSBIG.py +++ b/src/core/pyros_django/agent/AgentDeviceSBIG.py @@ -25,8 +25,10 @@ class AgentDeviceSBIG(AgentDevice): # Agent level specific commands # @override superclass Agent AGENT_SPECIFIC_COMMANDS = [ - "do_sbig_specific1", - "set_sbig_specific2", + "do_ad_sbig_specific1", + "set_ad_sbig_specific2", + "do_ad_sbig_specific3_unimplemented", + "do_ad_sbig_specific4_unimplemented", ] _agent_device_telescope_status = None @@ -54,7 +56,6 @@ class AgentDeviceSBIG(AgentDevice): - """ ================================================================= FUNCTIONS RUN INSIDE MAIN THREAD @@ -138,11 +139,15 @@ class AgentDeviceSBIG(AgentDevice): super().do_log() - def do_sbig_specific10(self): + ''' + AGENT LEVEL SPECIFIC COMMANDS + ''' + def do_ad_sbig_specific1(self): print("processing do_sbig_specific1... ") - def set_sbig_specific20(self): + def set_ad_sbig_specific2(self): print("processing set_sbig_specific2... ") + # @Override def get_device_status(self): diff --git a/src/core/pyros_django/agent/AgentMultiRequester.py b/src/core/pyros_django/agent/AgentMultiRequester.py index f57168c..0a5bc69 100755 --- a/src/core/pyros_django/agent/AgentMultiRequester.py +++ b/src/core/pyros_django/agent/AgentMultiRequester.py @@ -21,7 +21,7 @@ class AgentMultiRequester(Agent): # Run the assertion tests at the end TEST_WITH_FINAL_TEST = True #TEST_MAX_DURATION_SEC = None - TEST_MAX_DURATION_SEC = 100 + TEST_MAX_DURATION_SEC = 110 # Who should I send commands to ? #TEST_COMMANDS_DEST = "myself" #TEST_COMMANDS_DEST = "AgentDeviceTelescopeGemini" @@ -96,10 +96,12 @@ class AgentMultiRequester(Agent): 'ad_sensor UNKNOWN_NATIVE_CMD', 'ad_filtersel do_unimplemented', - 'ad_filtersel do_sbig_specific1', + 'ad_filtersel do_ad_sbig_specific1', + 'ad_filtersel do_ad_sbig_specific3_unimplemented', 'ad_filtersel do_unknown', - 'ad_filtersel set_sbig_specific2', + 'ad_filtersel set_ad_sbig_specific2', 'ad_shutter do_unimplemented', + 'ad_filtersel do_ad_sbig_specific4_unimplemented', 'ad_sensor do_unimplemented', #'ad_mount do_init', diff --git a/src/core/pyros_django/common/models.py b/src/core/pyros_django/common/models.py index 73a212e..c09d3c8 100644 --- a/src/core/pyros_django/common/models.py +++ b/src/core/pyros_django/common/models.py @@ -706,7 +706,7 @@ class Command(models.Model): # --- BOOLEAN (test) functions --- - def is_agent_level_general_cmd(self): + def is_agent_general_cmd(self): """ Is this a general command ? It is the case if command is of style "do_set:state:idle" or "do_restart" or "do_flush"... -- libgit2 0.21.2