diff --git a/privatedev/plugin/agent/AgentImagesCalibrator.py b/privatedev/plugin/agent/AgentImagesCalibrator.py index f046b56..8a988a9 100644 --- a/privatedev/plugin/agent/AgentImagesCalibrator.py +++ b/privatedev/plugin/agent/AgentImagesCalibrator.py @@ -23,7 +23,7 @@ for short_path in short_paths: if path not in sys.path: sys.path.insert(0, path) -from src.core.pyros_django.agent.Agent import Agent, build_agent, log +from src.core.pyros_django.agent.Agent import Agent, build_agent, log, parse_args # = Specials import glob @@ -64,10 +64,10 @@ class AgentImagesCalibrator(Agent): ================================================================= """ - def __init__(self, name:str=None): + def __init__(self, name:str=None, simulated_computer=None): if name is None: name = self.__class__.__name__ - super().__init__() + super().__init__(simulated_computer=simulated_computer) def _init(self): super()._init() @@ -97,7 +97,7 @@ class AgentImagesCalibrator(Agent): home = guitastro.Home(self._home) # === Instanciate an object Filenames to manage file names - self._filename_manager = guitastro.Filenames() + self._filename_manager = guitastro.FileNames() self._filename_manager.naming("PyROS.1") # === Set longitude to ima object to generate the night yyyymmdd and subdirectories yyyy/mm/dd @@ -332,7 +332,7 @@ class AgentImagesCalibrator(Agent): return s if __name__ == "__main__": - - agent = build_agent(AgentImagesCalibrator) + args = parse_args(sys.argv[1:]) + agent = build_agent(AgentImagesCalibrator,param_constr=args) print(agent) agent.run() diff --git a/privatedev/plugin/agent/AgentImagesProcessor.py b/privatedev/plugin/agent/AgentImagesProcessor.py index 19ff6cf..6d7afcf 100755 --- a/privatedev/plugin/agent/AgentImagesProcessor.py +++ b/privatedev/plugin/agent/AgentImagesProcessor.py @@ -20,7 +20,7 @@ for short_path in short_paths: if path not in sys.path: sys.path.insert(0, path) -from src.core.pyros_django.agent.Agent import Agent, build_agent, log +from src.core.pyros_django.agent.Agent import Agent, build_agent, log, parse_args # = Specials import glob @@ -320,10 +320,8 @@ class AgentImagesProcessor(Agent): return s if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Start the agent.') - parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store") - parser.add_argument("-t", action="store_true") - args = vars(parser.parse_args()) + args = parse_args(sys.argv[1:]) + #args = vars(parser.parse_args()) agent = build_agent(AgentImagesProcessor,param_constr=args) print(agent) agent.run() diff --git a/privatedev/plugin/agent/AgentTriton.py b/privatedev/plugin/agent/AgentTriton.py index 5723191..9d041ed 100755 --- a/privatedev/plugin/agent/AgentTriton.py +++ b/privatedev/plugin/agent/AgentTriton.py @@ -11,7 +11,7 @@ if pwd not in sys.path: sys.path.append(pwd) ##from .Agent import Agent -from src.core.pyros_django.agent.Agent import Agent, build_agent +from src.core.pyros_django.agent.Agent import Agent, build_agent, parse_args ##log = L.setupLogger("AgentXTaskLogger", "AgentX") @@ -158,10 +158,7 @@ class AgentTriton(Agent): ================================================================= """ if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Start a agentSST.') - parser.add_argument("--computer",dest="computer",help='Launch agent with simulated computer hostname',action="store") - parser.add_argument("-t", action="store_true") - args = vars(parser.parse_args()) + args = parse_args(sys.argv[1:]) agent = build_agent(AgentTriton,param_constr=args) ''' -- libgit2 0.21.2