Esempio n. 1
0
    def launch(self):
        global_parser = ConfigurationParser.GlobalParser()
        global_configuration = global_parser.parse(self.config_dir)
        machine_configuration = global_configuration.machines.get(self.machine_name)
        if machine_configuration is None:
            raise Exception("Machine %s not found" % self.machine_name)

        self._create_socket()

        processes = []
        for instance_name in machine_configuration.instances:
            instance_config = machine_configuration.instances[instance_name]
            if isinstance(self.logging_file_config, dict):
                logging_file_config = self.logging_file_config[instance_name]
            else:
                logging_file_config = self.logging_file_config
            if self.debugger_ports is None:
                debugger_port = "None"
            else:
                debugger_port = self.debugger_ports.get(instance_name, "None")
            args = (
                        "python",
                        "-OO",
                        __file__,
                        self.config_dir,
                        self.machine_name, instance_name,
                        logging_file_config,
                        str(self.waiting_port),
                        str(debugger_port)
                    )
            subprocess_kargs = dict(
                    args = args,
                    stdin = subprocess.PIPE
                )
            process = process_starter.start_process(instance_config.user, (), subprocess_kargs)
            processes.append(process)

        self.notify_and_wait()

        for process in processes:
            try:
                process.stdin.write("\n")
            except:
                pass

        self.wait_for_subprocesses(processes)

        if len(processes) > 0:
            for process in processes:
                process.terminate()

        self.wait_for_subprocesses(processes)

        if len(processes) > 0:
            for process in processes:
                process.kill()

        self.wait_for_subprocesses(processes)
Esempio n. 2
0
    def launch(self):
        global_parser = ConfigurationParser.GlobalParser()
        global_configuration = global_parser.parse(self.config_dir)
        machine_configuration = global_configuration.machines.get(
            self.machine_name)
        if machine_configuration is None:
            raise Exception("Machine %s not found" % self.machine_name)

        self._create_socket()

        processes = []
        for instance_name in machine_configuration.instances:
            instance_config = machine_configuration.instances[instance_name]
            if isinstance(self.logging_file_config, dict):
                logging_file_config = self.logging_file_config[instance_name]
            else:
                logging_file_config = self.logging_file_config
            if self.debugger_ports is None:
                debugger_port = "None"
            else:
                debugger_port = self.debugger_ports.get(instance_name, "None")
            args = ("python", "-OO", __file__, self.config_dir,
                    self.machine_name, instance_name, logging_file_config,
                    str(self.waiting_port), str(debugger_port))
            subprocess_kargs = dict(args=args, stdin=subprocess.PIPE)
            process = process_starter.start_process(instance_config.user, (),
                                                    subprocess_kargs)
            processes.append(process)

        self.notify_and_wait()

        for process in processes:
            try:
                process.stdin.write("\n")
            except:
                pass

        self.wait_for_subprocesses(processes)

        if len(processes) > 0:
            for process in processes:
                killer.term(process)

        self.wait_for_subprocesses(processes)

        if len(processes) > 0:
            for process in processes:
                killer.kill(process)

        self.wait_for_subprocesses(processes)
Esempio n. 3
0
    def launch(self):
        global_configuration = load_dir(self.config_dir)
        host_configuration = global_configuration.get(self.host_name)
        if host_configuration is None:
            raise Exception("Machine %s not found" % self.host_name)

        os_processes = []
        for process_name in host_configuration:
            if isinstance(self.logging_file_config, dict):
                logging_file_config = self.logging_file_config[process_name]
            else:
                logging_file_config = self.logging_file_config
            if self.debugger_ports is None:
                debugger_port = "None"
            else:
                debugger_port = self.debugger_ports.get(process_name, "None")
            args = (
                        sys.executable,
                        "-OO",
                        __file__,
                        self.config_dir,
                        self.host_name, 
                        process_name,
                        logging_file_config,
                        str(debugger_port)
                    )
            subprocess_kargs = dict(
                    args = args,
                    stdin = subprocess.PIPE
                )

            os_process = process_starter.start_process((), subprocess_kargs)
            os_processes.append(os_process)

        self.notify_and_wait()

        if len(os_processes) > 0:
            for os_process in os_processes:
                try:
                    os_process.terminate()
                except:
                    pass

        self.wait_for_subprocesses(os_processes)

        if len(os_processes) > 0:
            for os_process in os_processes:
                os_process.kill()

        self.wait_for_subprocesses(os_processes)
Esempio n. 4
0
    def launch(self):
        global_configuration = load_dir(self.config_dir)
        host_configuration = global_configuration.get(self.host_name)
        if host_configuration is None:
            raise Exception("Machine %s not found" % self.host_name)

        os_processes = []
        for process_name in host_configuration:
            if isinstance(self.logging_file_config, dict):
                logging_file_config = self.logging_file_config[process_name]
            else:
                logging_file_config = self.logging_file_config
            if self.debugger_ports is None:
                debugger_port = "None"
            else:
                debugger_port = self.debugger_ports.get(process_name, "None")
            args = (
                        sys.executable,
                        "-OO",
                        __file__,
                        self.config_dir,
                        self.host_name, 
                        process_name,
                        logging_file_config,
                        str(debugger_port)
                    )
            subprocess_kargs = dict(
                    args = args,
                    stdin = subprocess.PIPE
                )

            os_process = process_starter.start_process((), subprocess_kargs)
            os_processes.append(os_process)

        self.notify_and_wait()

        if len(os_processes) > 0:
            for os_process in os_processes:
                try:
                    os_process.terminate()
                except:
                    pass

        self.wait_for_subprocesses(os_processes)

        if len(os_processes) > 0:
            for os_process in os_processes:
                os_process.kill()

        self.wait_for_subprocesses(os_processes)