Commit 2accd03b2c4c99654f8aa68133b50a5d2ef781ce
1 parent
f098fd90
Exists in
dev
amelioration AgentMultiRequester (stop quand plus de commande à envoyer)
=> tests plus courts
Showing
2 changed files
with
40 additions
and
12 deletions
Show diff stats
src/core/pyros_django/agent/Agent.py
... | ... | @@ -550,9 +550,12 @@ class Agent: |
550 | 550 | self.print("CTRL-C Interrupted, I kill the current thread (process) before exiting (if exists)") |
551 | 551 | self._kill_running_device_cmd_if_exists("USER_CTRLC") |
552 | 552 | exit(1) |
553 | + | |
554 | + if self.TEST_MODE and self.TEST_WITH_FINAL_TEST: self._simulator_test_results() | |
553 | 555 | #if self._DO_EXIT: exit(0) |
554 | 556 | |
555 | 557 | |
558 | + | |
556 | 559 | # DEVICE level |
557 | 560 | def _kill_running_device_cmd_if_exists(self, abort_cmd_sender): |
558 | 561 | pass |
... | ... | @@ -619,7 +622,7 @@ class Agent: |
619 | 622 | if self.TEST_MAX_DURATION_SEC and (time.time()-self.start_time > self.TEST_MAX_DURATION_SEC): |
620 | 623 | self.print("Exit because of max duration set to ", self.TEST_MAX_DURATION_SEC, "s") |
621 | 624 | self._kill_running_device_cmd_if_exists(self.name) |
622 | - if self.TEST_MODE and self.TEST_WITH_FINAL_TEST: self._simulator_test_results() | |
625 | + #if self.TEST_MODE and self.TEST_WITH_FINAL_TEST: self._simulator_test_results() | |
623 | 626 | self._DO_MAIN_LOOP = False |
624 | 627 | return |
625 | 628 | |
... | ... | @@ -1346,8 +1349,10 @@ class Agent: |
1346 | 1349 | self._next_cmdts = None |
1347 | 1350 | else: |
1348 | 1351 | self._cmdts = self._simulator_get_next_command_to_send() |
1349 | - # No more command to send (from simulator) => return | |
1350 | - if self._cmdts is None: return | |
1352 | + # No more command to send (from simulator) => return and EXIT | |
1353 | + if self._cmdts is None: | |
1354 | + self._DO_MAIN_LOOP = False | |
1355 | + return | |
1351 | 1356 | # Send cmd (= set as pending and save) |
1352 | 1357 | self.print("***") |
1353 | 1358 | #self.print(f"*** SEND ", self._cmdts) | ... | ... |
src/core/pyros_django/agent/AgentMultiRequester.py
... | ... | @@ -20,8 +20,8 @@ class AgentMultiRequester(Agent): |
20 | 20 | TEST_MODE = True |
21 | 21 | # Run the assertion tests at the end |
22 | 22 | TEST_WITH_FINAL_TEST = True |
23 | - #TEST_MAX_DURATION_SEC = None | |
24 | - TEST_MAX_DURATION_SEC = 110 | |
23 | + TEST_MAX_DURATION_SEC = None | |
24 | + #TEST_MAX_DURATION_SEC = 110 | |
25 | 25 | # Who should I send commands to ? |
26 | 26 | #TEST_COMMANDS_DEST = "myself" |
27 | 27 | #TEST_COMMANDS_DEST = "AgentDeviceTelescopeGemini" |
... | ... | @@ -40,7 +40,16 @@ class AgentMultiRequester(Agent): |
40 | 40 | # Because of this command, the receiver agent : |
41 | 41 | # - will no more send any new command |
42 | 42 | # - will only execute "generic" commands (and not the "specific" ones) |
43 | - ##'ad_mount:set_state:idle', | |
43 | + ##'ad_mount set_state idle', | |
44 | + | |
45 | + # Commands ok for REAL GEMINI (not the simulator, but the REAL hardware telescope) | |
46 | + 'ad_mount get_ra', | |
47 | + 'ad_mount get_dec', | |
48 | + 'ad_mount get_radec', | |
49 | + #'ad_mount set_ra 14:20:51' | |
50 | + #'ad_mount set_dec +86:57:48' | |
51 | + #'ad_mount set_radec 14:20:51 +86:57:48', | |
52 | + #'ad_mount do_goto_radec 14:20:51 +86:57:48', | |
44 | 53 | |
45 | 54 | # Because of this command, the receiver agent(s) |
46 | 55 | # will now be able to send new commands |
... | ... | @@ -49,12 +58,26 @@ class AgentMultiRequester(Agent): |
49 | 58 | ##'ad_shutter:set_state:active', |
50 | 59 | ##'ad_sensor:set_state:active', |
51 | 60 | |
52 | - 'ad_mount do_init', | |
61 | + ##'ad_mount do_init', | |
53 | 62 | ###'ad_filtersel do_init', |
54 | 63 | ###'ad_shutter do_init', |
55 | 64 | ###'ad_sensor do_init', |
56 | 65 | |
57 | - 'ad_mount do_goto_radec 15 20', | |
66 | + # ERROR cases | |
67 | + # Unknown DCC | |
68 | + ##'ad_filtersel do_unimplemented', | |
69 | + # Unknown generic command | |
70 | + ##'ad_mount do_unknown', | |
71 | + # Unimplemented generic command | |
72 | + ##'ad_mount do_unimplemented', | |
73 | + # AD specific command implemented (OK) | |
74 | + ##'ad_mount do_ad_gemini_specific1', | |
75 | + # AD specific command UNimplemented (KO) | |
76 | + ##'ad_mount do_ad_sbig_specific3_unimplemented', | |
77 | + # AD specific command implemented (OK) | |
78 | + ##'ad_mount set_ad_gemini_specific2', | |
79 | + | |
80 | + ##'ad_mount do_goto_radec 15 20', | |
58 | 81 | ###'ad_filtersel do_goto 3', |
59 | 82 | |
60 | 83 | ##'ad_shutter:do_open', |
... | ... | @@ -167,8 +190,8 @@ class AgentMultiRequester(Agent): |
167 | 190 | |
168 | 191 | ] |
169 | 192 | |
170 | - #TEST_COMMANDS_LIST = TEST_COMMANDS_LIST_GEMINI_AND_SBIG | |
171 | - TEST_COMMANDS_LIST = TEST_COMMANDS_LIST_SBIG_ONLY | |
193 | + #TEST_COMMANDS_LIST = TEST_COMMANDS_LIST_SBIG_ONLY | |
194 | + TEST_COMMANDS_LIST = TEST_COMMANDS_LIST_GEMINI_AND_SBIG | |
172 | 195 | |
173 | 196 | |
174 | 197 | |
... | ... | @@ -197,14 +220,14 @@ class AgentMultiRequester(Agent): |
197 | 220 | #'ad_mount': 'AgentDeviceTelescopeGemini', |
198 | 221 | ''' |
199 | 222 | self._my_client_agents = { |
200 | - 'ad_mount': 'AgentDeviceTelescopeGemini.DC_Mount', | |
223 | + 'ad_mount': 'AgentDeviceGemini.DC_Mount', | |
201 | 224 | 'ad_filtersel': 'AgentDeviceSBIG.DC_FilterSelector', |
202 | 225 | 'ad_shutter': 'AgentDeviceSBIG.DC_DetectorShutter', |
203 | 226 | 'ad_sensor': 'AgentDeviceSBIG.DC_DetectorSensor', |
204 | 227 | } |
205 | 228 | ''' |
206 | 229 | self._my_client_agents = { |
207 | - 'ad_mount': 'AgentDeviceTelescopeGemini.Mount', | |
230 | + 'ad_mount': 'AgentDeviceGemini.Mount', | |
208 | 231 | 'ad_filtersel': 'AgentDeviceSBIG.FilterSelector', |
209 | 232 | 'ad_shutter': 'AgentDeviceSBIG.DetectorShutter', |
210 | 233 | 'ad_sensor': 'AgentDeviceSBIG.DetectorSensor', | ... | ... |