Commit 256352476c397e80e15ab9d166677ee6cba0b083

Authored by Alain Klotz
2 parents 29533885 8bd8b889
Exists in dev

Merge branch 'dev' of https://gitlab.irap.omp.eu/epallier/pyros into dev

privatedev/plugin/agent/Agent.py
... ... @@ -1643,7 +1643,8 @@ class Agent:
1643 1643 AgentCmd.objects.create(sender=self.name, recipient=recipient_agent, name=cmd_name)
1644 1644 """
1645 1645 #def send_command(self, to_agent, cmd_type, cmd_name, cmd_args=None):
1646   - def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None, timeout:int=None):
  1646 + #def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None, timeout:int=None):
  1647 + def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None):
1647 1648 """
1648 1649 #ex: send_command(“AgentX”,”GENERIC”,”EVAL”,“3+4”)
1649 1650 ex: send_command(“AgentX”,"EVAL”,“3+4”)
... ... @@ -2556,10 +2557,12 @@ class Agent:
2556 2557 =================================================================
2557 2558 """
2558 2559  
  2560 +import argparse
2559 2561 def extract_parameters():
2560 2562 """ Usage: Agent.py [-t] [configfile] """
2561 2563 # arg 1 : -t
2562 2564 # arg 2 : configfile
  2565 +
2563 2566 DEBUG_MODE = False
2564 2567 TEST_MODE = False
2565 2568 WITH_SIM = False
... ... @@ -2592,11 +2595,24 @@ def build_agent(Agent_type:Agent) -> Agent :
2592 2595 log.debug("debug mode is" + os.getenv("PYROS_DEBUG"))
2593 2596  
2594 2597 #print(logger)
2595   -
  2598 +
  2599 +
2596 2600 #agent = Agent("GenericAgent", configfile, RUN_IN_THREAD=True)
2597 2601 #agent = Agent_type(configfile, RUN_IN_THREAD, DEBUG_MODE=DEBUG_MODE)
2598 2602 #agent = Agent_type(RUN_IN_THREAD)
  2603 +
2599 2604 agent = Agent_type()
  2605 + if agent.name == "AgentSST":
  2606 + parser = argparse.ArgumentParser(description='Start a agentSST.')
  2607 + parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store")
  2608 + parser.add_argument("-t", action="store_true" )
  2609 +
  2610 + # parser.add_argument("-d", action="store_true" )
  2611 + # parser.add_argument("-s", action="store_true" )
  2612 + # parser.add_argument("-v", action="store_true" )
  2613 + args = parser.parse_args()
  2614 + if args.computer:
  2615 + agent.set_computer(args.computer)
2600 2616 # AgentSP isn't in a config, so to avoid that WITH_SIM returns an error it's a special case
2601 2617 if agent.name == "AgentSP":
2602 2618 agent._set_with_simulator(False)
... ...
src/core/pyros_django/agent/Agent.py
... ... @@ -1643,7 +1643,8 @@ class Agent:
1643 1643 AgentCmd.objects.create(sender=self.name, recipient=recipient_agent, name=cmd_name)
1644 1644 """
1645 1645 #def send_command(self, to_agent, cmd_type, cmd_name, cmd_args=None):
1646   - def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None, timeout:int=None):
  1646 + #def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None, timeout:int=None):
  1647 + def send_cmd_to(self, to_agent:str, cmd_name:str, cmd_args:str=None, validity:int=None):
1647 1648 """
1648 1649 #ex: send_command(“AgentX”,”GENERIC”,”EVAL”,“3+4”)
1649 1650 ex: send_command(“AgentX”,"EVAL”,“3+4”)
... ...