diff --git a/pyros.py b/pyros.py index c3a712f..cda2392 100755 --- a/pyros.py +++ b/pyros.py @@ -1124,8 +1124,9 @@ def new_start(configfile: str, observatory: str, unit: str, computer_hostname: s # if not test_mode(): current_processes.append( [execProcessFromVenvAsync(cmd), agent_name, -1] ) # Append this process ( [process id, agent_name, result=failure] ) # ("result" will be updated at the end of execution) - current_processes.append( - [execProcessFromVenvAsync(cmd,foreground), agent_name, -1]) + + process = execProcessFromVenvAsync(cmd,foreground) + # self.change_dir("..") os.chdir(current_dir) @@ -1134,38 +1135,24 @@ def new_start(configfile: str, observatory: str, unit: str, computer_hostname: s # os.chdir("..") # Wait for end of each process execution # for (p,agent) in current_processes: - for process in current_processes: - p, agent, _ = process - log.debug( - f"************ Waiting for end of execution of agent {agent} ************") - p.wait() - process[2] = p.returncode - print(f"************ END of execution of agent {agent} ************") - if p.returncode == 0: - printFullTerm( - Colors.GREEN, f"Process {agent} executed successfully") - # self.addExecuted(self.current_command, command) - else: - printFullTerm(Colors.WARNING, f"Process {agent} execution failed") - # self.addError(self.current_command, command) - - print() - print() - print("Synthesis of the results:") - for process in current_processes: - p, agent, returncode = process - if returncode == 0: - printFullTerm( - Colors.GREEN, f"Process {agent} executed successfully") - # self.addExecuted(self.current_command, command) - else: - printFullTerm(Colors.WARNING, f"Process {agent} execution failed") - # self.addError(self.current_command, command) + agent = agent_name + log.debug( + f"************ Waiting for end of execution of agent {agent} ************") + try: + process.wait() + except KeyboardInterrupt: + process.send_signal(signal.SIGINT) + process.wait() + print(f"************ END of execution of agent {agent} ************") + if process.returncode == 0: + printFullTerm( + Colors.GREEN, f"Process {agent} executed successfully") + # self.addExecuted(self.current_command, command) + else: + printFullTerm(Colors.WARNING, f"Process {agent} execution failed") + # self.addError(self.current_command, command) - # print("************ end of START() ************") - # Only according to the last process status: - # return True if p.returncode==0 else False - return True if p.returncode == 0 else False + return True if process.returncode == 0 else False @pyros_launcher.command(help="Stop pyros") def stop(): -- libgit2 0.21.2