Commit b06c19e619436bd3ead0d7c3e7aeac8aba94fdeb

Authored by Alexis Koralewski
1 parent 2ccd4797
Exists in dev

Fix import & init (add parse_args & simulated_computer) of AgentTriton, AgentIma…

…gesProcessor, AgentImagesCalibrator
privatedev/plugin/agent/AgentImagesCalibrator.py
... ... @@ -23,7 +23,7 @@ for short_path in short_paths:
23 23 if path not in sys.path:
24 24 sys.path.insert(0, path)
25 25  
26   -from src.core.pyros_django.agent.Agent import Agent, build_agent, log
  26 +from src.core.pyros_django.agent.Agent import Agent, build_agent, log, parse_args
27 27  
28 28 # = Specials
29 29 import glob
... ... @@ -64,10 +64,10 @@ class AgentImagesCalibrator(Agent):
64 64 =================================================================
65 65 """
66 66  
67   - def __init__(self, name:str=None):
  67 + def __init__(self, name:str=None, simulated_computer=None):
68 68 if name is None:
69 69 name = self.__class__.__name__
70   - super().__init__()
  70 + super().__init__(simulated_computer=simulated_computer)
71 71  
72 72 def _init(self):
73 73 super()._init()
... ... @@ -97,7 +97,7 @@ class AgentImagesCalibrator(Agent):
97 97 home = guitastro.Home(self._home)
98 98  
99 99 # === Instanciate an object Filenames to manage file names
100   - self._filename_manager = guitastro.Filenames()
  100 + self._filename_manager = guitastro.FileNames()
101 101 self._filename_manager.naming("PyROS.1")
102 102  
103 103 # === Set longitude to ima object to generate the night yyyymmdd and subdirectories yyyy/mm/dd
... ... @@ -332,7 +332,7 @@ class AgentImagesCalibrator(Agent):
332 332 return s
333 333  
334 334 if __name__ == "__main__":
335   -
336   - agent = build_agent(AgentImagesCalibrator)
  335 + args = parse_args(sys.argv[1:])
  336 + agent = build_agent(AgentImagesCalibrator,param_constr=args)
337 337 print(agent)
338 338 agent.run()
... ...
privatedev/plugin/agent/AgentImagesProcessor.py
... ... @@ -20,7 +20,7 @@ for short_path in short_paths:
20 20 if path not in sys.path:
21 21 sys.path.insert(0, path)
22 22  
23   -from src.core.pyros_django.agent.Agent import Agent, build_agent, log
  23 +from src.core.pyros_django.agent.Agent import Agent, build_agent, log, parse_args
24 24  
25 25 # = Specials
26 26 import glob
... ... @@ -320,10 +320,8 @@ class AgentImagesProcessor(Agent):
320 320 return s
321 321  
322 322 if __name__ == "__main__":
323   - parser = argparse.ArgumentParser(description='Start the agent.')
324   - parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store")
325   - parser.add_argument("-t", action="store_true")
326   - args = vars(parser.parse_args())
  323 + args = parse_args(sys.argv[1:])
  324 + #args = vars(parser.parse_args())
327 325 agent = build_agent(AgentImagesProcessor,param_constr=args)
328 326 print(agent)
329 327 agent.run()
... ...
privatedev/plugin/agent/AgentTriton.py
... ... @@ -11,7 +11,7 @@ if pwd not in sys.path:
11 11 sys.path.append(pwd)
12 12  
13 13 ##from .Agent import Agent
14   -from src.core.pyros_django.agent.Agent import Agent, build_agent
  14 +from src.core.pyros_django.agent.Agent import Agent, build_agent, parse_args
15 15  
16 16 ##log = L.setupLogger("AgentXTaskLogger", "AgentX")
17 17  
... ... @@ -158,10 +158,7 @@ class AgentTriton(Agent):
158 158 =================================================================
159 159 """
160 160 if __name__ == "__main__":
161   - parser = argparse.ArgumentParser(description='Start a agentSST.')
162   - parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store")
163   - parser.add_argument("-t", action="store_true")
164   - args = vars(parser.parse_args())
  161 + args = parse_args(sys.argv[1:])
165 162 agent = build_agent(AgentTriton,param_constr=args)
166 163  
167 164 '''
... ...