Beispiel #1
0
    def run(self):
        exit_code = 0

        sender_command = [
            "quiver-arrow", "send", self.url, "--impl", self.sender_impl,
            "--verbose"
        ]
        sender_command += self.sender_options

        receiver_command = [
            "quiver-arrow", "receive", self.url, "--impl", self.receiver_impl,
            "--verbose"
        ]
        receiver_command += self.receiver_options

        senders = list()
        receivers = list()

        for i in range(self.receiver_count):
            receiver = _plano.start_process(receiver_command)
            receivers.append(receiver)

        _plano.wait_for_port(self.port)

        for i in range(self.sender_count):
            sender = _plano.start_process(sender_command)
            senders.append(sender)

        try:
            try:
                for sender in senders:
                    _plano.wait_for_process(sender)

                for receiver in receivers:
                    _plano.wait_for_process(receiver)
            except:
                for sender in senders:
                    _plano.stop_process(sender)

                for receiver in receivers:
                    _plano.stop_process(receiver)

                raise

            for sender in senders:
                if sender.returncode != 0:
                    exit_code = 1
                    break

            for receiver in receivers:
                if receiver.returncode != 0:
                    exit_code = 1
                    break
        except KeyboardInterrupt:
            pass
        except:
            _traceback.print_exc()
            exit_code = 1
        finally:
            _plano.exit(exit_code)
Beispiel #2
0
    def run(self):
        exit_code = 0

        sender_command = ["quiver-arrow", "send", self.url, "--impl", self.sender_impl, "--verbose"]
        sender_command += self.sender_options

        receiver_command = ["quiver-arrow", "receive", self.url, "--impl", self.receiver_impl, "--verbose"]
        receiver_command += self.receiver_options

        senders = list()
        receivers = list()

        for i in range(self.receiver_count):
            receiver = _plano.start_process(receiver_command)
            receivers.append(receiver)

        _plano.wait_for_port(self.port)

        for i in range(self.sender_count):
            sender = _plano.start_process(sender_command)
            senders.append(sender)

        try:
            try:
                for sender in senders:
                    _plano.wait_for_process(sender)

                for receiver in receivers:
                    _plano.wait_for_process(receiver)
            except:
                for sender in senders:
                    _plano.stop_process(sender)

                for receiver in receivers:
                    _plano.stop_process(receiver)

                raise

            for sender in senders:
                if sender.returncode != 0:
                    exit_code = 1
                    break

            for receiver in receivers:
                if receiver.returncode != 0:
                    exit_code = 1
                    break
        except KeyboardInterrupt:
            pass
        except:
            _traceback.print_exc()
            exit_code = 1
        finally:
            _plano.exit(exit_code)
Beispiel #3
0
    def run(self):
        args = [
            self.url,
            "--messages", self.args.messages,
            "--body-size", self.args.body_size,
            "--credit", self.args.credit,
            "--transaction-size", self.args.transaction_size,
            "--timeout", self.args.timeout,
            "--output", self.output_dir,
        ]

        if self.durable:
            args += ["--durable"]

        if self.quiet:
            args += ["--quiet"]

        if self.verbose:
            args += ["--verbose"]

        sender_args = ["quiver-arrow", "send", "--impl", self.sender_impl.name] + args
        receiver_args = ["quiver-arrow", "receive", "--impl", self.receiver_impl.name] + args

        if self.peer_to_peer:
            receiver_args += ["--server", "--passive"]

        self.start_time = now()

        receiver = _plano.start_process(receiver_args)

        if self.peer_to_peer:
            _plano.wait_for_port(self.port, host=self.host)

        sender = _plano.start_process(sender_args)

        try:
            if not self.quiet:
                self.print_status(sender, receiver)

            _plano.wait_for_process(sender)
            _plano.wait_for_process(receiver)
        except:
            _plano.stop_process(sender)
            _plano.stop_process(receiver)

            raise

        if (sender.returncode, receiver.returncode) != (0, 0):
            _plano.exit(1)

        if not self.quiet:
            self.print_summary()
Beispiel #4
0
    def run(self):
        args = list()

        if self.duration == 0:
            args += ["--count", self.args.count]
        else:
            args += ["--duration", self.args.duration]

        args += [
            "--body-size",
            self.args.body_size,
            "--credit",
            self.args.credit,
            "--transaction-size",
            self.args.transaction_size,
            "--timeout",
            self.args.timeout,
        ]

        if self.durable:
            args += ["--durable"]

        if self.quiet:
            args += ["--quiet"]

        if self.verbose:
            args += ["--verbose"]

        if self.username:
            args.append("username={}".format(self.username))

        if self.password:
            args.append("password={}".format(self.password))

        if self.args.cert and self.args.key:
            args += ["--key", self.args.key]
            args += ["--cert", self.args.cert]

        args += ["--output", self.output_dir]

        sender_args = [
            "quiver-arrow", "send", self.url, "--impl", self.sender_impl.name
        ] + args
        receiver_args = [
            "quiver-arrow", "receive", self.url, "--impl",
            self.receiver_impl.name
        ] + args

        if self.peer_to_peer:
            receiver_args += ["--server", "--passive"]

        self.start_time = now()

        #_os.environ["DEBUG"] = "*"
        receiver = _plano.start_process(receiver_args)
        #del _os.environ["DEBUG"]

        if self.peer_to_peer:
            _plano.wait_for_port(self.port, host=self.host)

        #_os.environ["PN_TRACE_FRM"] = "1"
        sender = _plano.start_process(sender_args)
        #del _os.environ["PN_TRACE_FRM"]

        try:
            if not self.quiet:
                self.print_status(sender, receiver)

            _plano.check_process(receiver)
            _plano.check_process(sender)
        except _plano.CalledProcessError as e:
            _plano.error(e)
        finally:
            _plano.stop_process(sender)
            _plano.stop_process(receiver)

        if (sender.returncode, receiver.returncode) != (0, 0):
            _plano.exit(1)

        if not self.quiet:
            self.print_summary()
Beispiel #5
0
    def run(self):
        args = list()

        if self.duration == 0:
            args += ["--count", self.args.count]
        else:
            args += ["--duration", self.args.duration]

        args += [
            "--body-size", self.args.body_size,
            "--credit", self.args.credit,
            "--transaction-size", self.args.transaction_size,
            "--timeout", self.args.timeout,
        ]

        if self.durable:
            args += ["--durable"]

        if self.quiet:
            args += ["--quiet"]

        if self.verbose:
            args += ["--verbose"]

        if self.args.cert and self.args.key:
            args += ["--key", self.args.key]
            args += ["--cert", self.args.cert]

        args += ["--output", self.output_dir]

        sender_args = ["quiver-arrow", "send", self.url, "--impl", self.sender_impl.name] + args
        receiver_args = ["quiver-arrow", "receive", self.url, "--impl", self.receiver_impl.name] + args

        if self.peer_to_peer:
            receiver_args += ["--server", "--passive"]

        self.start_time = now()

        #_os.environ["DEBUG"] = "*"
        receiver = _plano.start_process(receiver_args)
        #del _os.environ["DEBUG"]

        if self.peer_to_peer:
            _plano.wait_for_port(self.port, host=self.host)

        #_os.environ["PN_TRACE_FRM"] = "1"
        sender = _plano.start_process(sender_args)
        #del _os.environ["PN_TRACE_FRM"]

        try:
            if not self.quiet:
                self.print_status(sender, receiver)

            _plano.check_process(receiver)
            _plano.check_process(sender)
        except _plano.CalledProcessError as e:
            _plano.error(e)
        finally:
            _plano.stop_process(sender)
            _plano.stop_process(receiver)

        if (sender.returncode, receiver.returncode) != (0, 0):
            _plano.exit(1)

        if not self.quiet:
            self.print_summary()