Commit 1fdda5a5b608a84c0c4ee9d857917ddbde8ec00e

Authored by Etienne Pallier
1 parent fc277cf1
Exists in dev

AgentDevice*.py cleaned pour mode DEBUG off

src/core/pyros_django/agent/AgentDeviceGemini.py
@@ -86,10 +86,10 @@ class AgentDeviceGemini(AgentDevice): @@ -86,10 +86,10 @@ class AgentDeviceGemini(AgentDevice):
86 ##self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus) 86 ##self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus)
87 """ 87 """
88 if not AgentDeviceTelescopeStatus.objects.exists(): 88 if not AgentDeviceTelescopeStatus.objects.exists():
89 - print("CREATE first row") 89 + self.printd("CREATE first row")
90 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1) 90 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1)
91 # Get 1st row (will be updated at each iteration by routine_process() with current device status) 91 # Get 1st row (will be updated at each iteration by routine_process() with current device status)
92 - print("GET first row") 92 + self.printd("GET first row")
93 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1) 93 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1)
94 """ 94 """
95 95
@@ -98,7 +98,7 @@ class AgentDeviceGemini(AgentDevice): @@ -98,7 +98,7 @@ class AgentDeviceGemini(AgentDevice):
98 ##HOST, PORT = "82.64.28.71", 11110 98 ##HOST, PORT = "82.64.28.71", 11110
99 #HOST, PORT = "localhost", 11110 99 #HOST, PORT = "localhost", 11110
100 ##self.tele_ctrl = TelescopeControllerGemini(HOST, PORT, True) 100 ##self.tele_ctrl = TelescopeControllerGemini(HOST, PORT, True)
101 - ##self._log.print(f"init done for {name}") 101 + ##self._log.self.printd(f"init done for {name}")
102 102
103 103
104 def init(self): 104 def init(self):
@@ -149,7 +149,7 @@ class AgentDeviceGemini(AgentDevice): @@ -149,7 +149,7 @@ class AgentDeviceGemini(AgentDevice):
149 cmd="get_date" 149 cmd="get_date"
150 res = self._device_ctrl.exec_cmd(cmd) 150 res = self._device_ctrl.exec_cmd(cmd)
151 self.printd("result is", str(res)) 151 self.printd("result is", str(res))
152 - if res.ok: print("OK") 152 + if res.ok: self.printd("OK")
153 dev_date = str(res) 153 dev_date = str(res)
154 time.sleep(1) 154 time.sleep(1)
155 155
@@ -157,7 +157,7 @@ class AgentDeviceGemini(AgentDevice): @@ -157,7 +157,7 @@ class AgentDeviceGemini(AgentDevice):
157 cmd="get_time" 157 cmd="get_time"
158 res = self._device_ctrl.exec_cmd(cmd) 158 res = self._device_ctrl.exec_cmd(cmd)
159 self.printd("result is", str(res)) 159 self.printd("result is", str(res))
160 - if res.ok: print("OK") 160 + if res.ok: self.printd("OK")
161 dev_time = str(res) 161 dev_time = str(res)
162 time.sleep(1) 162 time.sleep(1)
163 163
@@ -169,7 +169,7 @@ class AgentDeviceGemini(AgentDevice): @@ -169,7 +169,7 @@ class AgentDeviceGemini(AgentDevice):
169 cmd="Mount.get_radec" 169 cmd="Mount.get_radec"
170 res = self._device_ctrl.exec_cmd(cmd) 170 res = self._device_ctrl.exec_cmd(cmd)
171 self.printd("result is", str(res)) 171 self.printd("result is", str(res))
172 - if res.ok: print("OK") 172 + if res.ok: self.printd("OK")
173 dev_radec = str(res) 173 dev_radec = str(res)
174 time.sleep(1) 174 time.sleep(1)
175 175
@@ -180,9 +180,9 @@ class AgentDeviceGemini(AgentDevice): @@ -180,9 +180,9 @@ class AgentDeviceGemini(AgentDevice):
180 AGENT LEVEL SPECIFIC COMMANDS 180 AGENT LEVEL SPECIFIC COMMANDS
181 ''' 181 '''
182 def do_ad_gemini_specific1(self): 182 def do_ad_gemini_specific1(self):
183 - print("processing ad_specific1... ") 183 + self.printd("processing ad_specific1... ")
184 def set_ad_gemini_specific2(self): 184 def set_ad_gemini_specific2(self):
185 - print("processing set_specific2... ") 185 + self.printd("processing set_specific2... ")
186 186
187 187
188 188
@@ -204,6 +204,6 @@ if __name__ == "__main__": @@ -204,6 +204,6 @@ if __name__ == "__main__":
204 #agent = AgentX() 204 #agent = AgentX()
205 agent = AgentDeviceTelescopeGemini(configfile, RUN_IN_THREAD) 205 agent = AgentDeviceTelescopeGemini(configfile, RUN_IN_THREAD)
206 agent.setSimulatorMode(TEST_MODE) 206 agent.setSimulatorMode(TEST_MODE)
207 - print(agent) 207 + self.printd(agent)
208 ''' 208 '''
209 agent.run() 209 agent.run()
src/core/pyros_django/agent/AgentDeviceSBIG.py
@@ -84,10 +84,10 @@ class AgentDeviceSBIG(AgentDevice): @@ -84,10 +84,10 @@ class AgentDeviceSBIG(AgentDevice):
84 ##self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus) 84 ##self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus)
85 """ 85 """
86 if not AgentDeviceTelescopeStatus.objects.exists(): 86 if not AgentDeviceTelescopeStatus.objects.exists():
87 - print("CREATE first row") 87 + self.printd("CREATE first row")
88 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1) 88 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1)
89 # Get 1st row (will be updated at each iteration by routine_process() with current device status) 89 # Get 1st row (will be updated at each iteration by routine_process() with current device status)
90 - print("GET first row") 90 + self.printd("GET first row")
91 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1) 91 self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1)
92 """ 92 """
93 93
@@ -96,7 +96,7 @@ class AgentDeviceSBIG(AgentDevice): @@ -96,7 +96,7 @@ class AgentDeviceSBIG(AgentDevice):
96 ##HOST, PORT = "82.64.28.71", 11110 96 ##HOST, PORT = "82.64.28.71", 11110
97 #HOST, PORT = "localhost", 11110 97 #HOST, PORT = "localhost", 11110
98 ##self.tele_ctrl = TelescopeControllerGemini(HOST, PORT, True) 98 ##self.tele_ctrl = TelescopeControllerGemini(HOST, PORT, True)
99 - ##self._log.print(f"init done for {name}") 99 + ##self._log.self.printd(f"init done for {name}")
100 100
101 101
102 def init(self): 102 def init(self):
@@ -144,9 +144,9 @@ class AgentDeviceSBIG(AgentDevice): @@ -144,9 +144,9 @@ class AgentDeviceSBIG(AgentDevice):
144 AGENT LEVEL SPECIFIC COMMANDS 144 AGENT LEVEL SPECIFIC COMMANDS
145 ''' 145 '''
146 def do_ad_sbig_specific1(self): 146 def do_ad_sbig_specific1(self):
147 - print("processing do_sbig_specific1... ") 147 + self.printd("processing do_sbig_specific1... ")
148 def set_ad_sbig_specific2(self): 148 def set_ad_sbig_specific2(self):
149 - print("processing set_sbig_specific2... ") 149 + self.printd("processing set_sbig_specific2... ")
150 150
151 151
152 # @Override 152 # @Override
@@ -155,14 +155,14 @@ class AgentDeviceSBIG(AgentDevice): @@ -155,14 +155,14 @@ class AgentDeviceSBIG(AgentDevice):
155 cmd="get_date" 155 cmd="get_date"
156 res = self._device_ctrl.exec_cmd(cmd) 156 res = self._device_ctrl.exec_cmd(cmd)
157 self.printd("result is", str(res)) 157 self.printd("result is", str(res))
158 - if res.ok: print("OK") 158 + if res.ok: self.printd("OK")
159 dev_date = str(res) 159 dev_date = str(res)
160 time.sleep(1) 160 time.sleep(1)
161 161
162 cmd="get_time" 162 cmd="get_time"
163 res = self._device_ctrl.exec_cmd(cmd) 163 res = self._device_ctrl.exec_cmd(cmd)
164 self.printd("result is", str(res)) 164 self.printd("result is", str(res))
165 - if res.ok: print("OK") 165 + if res.ok: self.printd("OK")
166 dev_time = str(res) 166 dev_time = str(res)
167 time.sleep(1) 167 time.sleep(1)
168 168
@@ -170,7 +170,7 @@ class AgentDeviceSBIG(AgentDevice): @@ -170,7 +170,7 @@ class AgentDeviceSBIG(AgentDevice):
170 cmd="get radec" 170 cmd="get radec"
171 res = self._device_ctrl.execute_cmd(cmd) 171 res = self._device_ctrl.execute_cmd(cmd)
172 self.printd("result is", str(res)) 172 self.printd("result is", str(res))
173 - if res.ok: print("OK") 173 + if res.ok: self.printd("OK")
174 dev_radec = str(res) 174 dev_radec = str(res)
175 time.sleep(1) 175 time.sleep(1)
176 176
@@ -198,6 +198,6 @@ if __name__ == "__main__": @@ -198,6 +198,6 @@ if __name__ == "__main__":
198 #agent = AgentX() 198 #agent = AgentX()
199 agent = AgentDeviceTelescopeGemini(configfile, RUN_IN_THREAD) 199 agent = AgentDeviceTelescopeGemini(configfile, RUN_IN_THREAD)
200 agent.setSimulatorMode(TEST_MODE) 200 agent.setSimulatorMode(TEST_MODE)
201 - print(agent) 201 + self.printd(agent)
202 ''' 202 '''
203 agent.run() 203 agent.run()