Commit 6a60b61d37651c9a7a71bbf5246961c45ba50ef7

Authored by Etienne Pallier
1 parent 9b3ddd6e
Exists in dev

Agent on/off

privatedev/config/tnc/observatory_tnc.yml
... ... @@ -370,7 +370,7 @@ OBSERVATORY:
370 370 name: AgentImagesProcessor_tnc_up1_ep
371 371 computer: EtienneComputer
372 372 protocol: privatedev/plugin/agent/AgentImagesProcessor_tnc_up1.py
373   - is_active: False
  373 + is_active: True
374 374 - AGENT:
375 375 name: AgentSST3
376 376 computer: EtienneComputer
... ... @@ -380,7 +380,7 @@ OBSERVATORY:
380 380 computer: EtienneComputer
381 381 protocol: private/plugin/agent/AgentTriton.py
382 382 path: private/plugin/agent/triton
383   - is_active: False
  383 + is_active: True
384 384 # Basic Agent (for EP, to test the Agent base class)
385 385 - AGENT:
386 386 name: AgentBasic
... ...
src/core/pyros_django/agent/Agent.py
... ... @@ -630,6 +630,7 @@ class Agent:
630 630 #self._set_mode(MODES.)
631 631  
632 632 log.addHandler(handler_filebyagent(logging.INFO, self.__class__.__name__))
  633 + #log.addHandler(handler_filebyagent(logging.INFO, self.name))
633 634 log.debug("start Agent init")
634 635 obs_config_file_path = os.environ["PATH_TO_OBSCONF_FILE"]
635 636 path_to_obs_config_folder = os.environ["PATH_TO_OBSCONF_FOLDER"]
... ... @@ -1192,10 +1193,7 @@ class Agent:
1192 1193  
1193 1194 # TEST MODE only : send next command from test scenario (not waiting for current cmd to be finished)
1194 1195 #if self.is_in_test_mode():
1195   - print("**********************************************************")
1196   - print("AVANT")
1197 1196 self.__TEST_send_next_test_cmd()
1198   - print("fini")
1199 1197  
1200 1198 #self.printd("====== END COMMMANDS PROCESSING ======")
1201 1199  
... ... @@ -1416,7 +1414,7 @@ class Agent:
1416 1414 # (also to let another agent having the chance to send a me command)
1417 1415 if self.__DELAY_NB_SEC :
1418 1416 #random_waiting_sec = random.randint(0,5)
1419   - log.info(f"Waiting {self.__DELAY_NB_SEC} sec (random) before starting new iteration...")
  1417 + log.debug(f"Waiting {self.__DELAY_NB_SEC} sec (random) before starting new iteration...")
1420 1418 #time.sleep(random_waiting_sec)
1421 1419 self.waitfor(self.__DELAY_NB_SEC)
1422 1420  
... ... @@ -1686,7 +1684,7 @@ class Agent:
1686 1684 """
1687 1685  
1688 1686 def sleep(self, nbsec:float):
1689   - log.info(f"Now, waiting (sleeping) for {nbsec} second(s)...")
  1687 + log.debug(f"Now, waiting (sleeping) for {nbsec} second(s)...")
1690 1688  
1691 1689 # thread
1692 1690 if self.__CC_thread and isinstance(self.__CC_thread, StoppableThreadEvenWhenSleeping): #and self.RUN_IN_THREAD:
... ...
src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html
... ... @@ -481,10 +481,10 @@
481 481 fetch("/api/agent_survey/{{agent_name}}?format=json").then(response => response.json()).then(function(data){
482 482 app2.agent = data;
483 483 if (data.status == "EXITING"){
484   - $("#agent_title").text(data.name + " is not available").css("color","red")
  484 + $("#agent_title").text(data.name + " (OFF)").css("color","red")
485 485 }
486 486 else{
487   - $("#agent_title").text(data.name + " is available").css("color","green")
  487 + $("#agent_title").text(data.name + " (ON)").css("color","green")
488 488 }
489 489  
490 490 if (previous_status != data.status){
... ...
src/pyros_logger.py
... ... @@ -42,8 +42,12 @@ class _FilterOnDebugModeAndNoLevelINFO(logging.Filter):
42 42 # On affiche TOUJOURS sur la console SAUF level debug si mode DEBUG is OFF
43 43 #print("level name", logging.getLevelName(logRecord.levelno))
44 44 #if logRecord.levelno != 10: return True
  45 +
  46 + #'''
45 47 if logging.getLevelName(logRecord.levelno) == 'INFO': return False
46 48 if logging.getLevelName(logRecord.levelno) == 'DEBUG': return (debug_mode == 1)
  49 + #'''
  50 +
47 51 return True
48 52 # On n'affiche sur la console QUE si mode DEBUG is ON
49 53 #return (debug_mode == 1)
... ...