Пример #1
0
    def start(self, port):
        assert self.proc is None

        _plano.make_dir(self.output_dir)

        self.output = open(self.output_file, "w")

        command = [
            "quiver-server",
            "//localhost:{}/q0".format(port),
            "--impl",
            self.impl,
            "--ready-file",
            self.ready_file,
            "--verbose",
        ]

        _plano.write(self.command_file, "{}\n".format(" ".join(command)))

        self.proc = _plano.start_process(command,
                                         stdout=self.output,
                                         stderr=self.output)

        for i in range(30):
            if _plano.read(self.ready_file) == "ready\n":
                break

            _plano.sleep(0.2)
        else:
            raise _Timeout("Timed out waiting for server to be ready")
Пример #2
0
    def start(self, port):
        assert self.proc is None

        _plano.make_dir(self.output_dir)

        self.output = open(self.output_file, "w")

        command = [
            "quiver-server", "//127.0.0.1:{}/q0".format(port),
            "--impl", self.impl,
            "--ready-file", self.ready_file,
            "--verbose",
        ]

        _plano.write(self.command_file, "{}\n".format(" ".join(command)))

        self.proc = _plano.start_process(command, stdout=self.output, stderr=self.output)

        for i in range(30):
            if _plano.read(self.ready_file) == "ready\n":
                break

            _plano.sleep(0.2)
        else:
            raise _Timeout("Timed out waiting for server to be ready")
Пример #3
0
    def on_start(self, event):
        domain = "{}:{}".format(self.broker.host, self.broker.port)

        event.container.listen(domain)

        _plano.notice("Listening on '{}'", domain)

        if self.broker.ready_file != "-":
            _plano.write(self.broker.ready_file, "ready\n")
Пример #4
0
    def stop(self):
        assert self.proc is not None

        _plano.stop_process(self.proc)

        if self.proc.returncode > 0:
            _plano.write(self.status_file, "FAILED\n")
        else:
            _plano.write(self.status_file, "PASSED\n")

        _plano.remove(self.ready_file)
Пример #5
0
    def stop(self):
        assert self.proc is not None

        _plano.stop_process(self.proc)

        self.output.close()

        if self.proc.returncode > 0 and self.proc.returncode < 128:
            _plano.write(self.status_file, "FAILED\n")
        else:
            _plano.write(self.status_file, "PASSED\n")

        _plano.remove(self.ready_file)
Пример #6
0
    def run(self, port, args):
        _plano.make_dir(self.output_dir)

        command = [
            "quiver", "//127.0.0.1:{}/q0".format(port),
            "--sender", self.sender_impl,
            "--receiver", self.receiver_impl,
            "--count", args.count,
            "--duration", args.duration,
            "--body-size", args.body_size,
            "--credit", args.credit,
            "--timeout", args.timeout,
        ]

        if self.peer_to_peer:
            command += ["--peer-to-peer"]

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

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

        _plano.write(self.command_file, "{}\n".format(" ".join(command)))

        with open(self.output_file, "w") as f:
            try:
                _plano.call(command, stdout=f, stderr=f)
            except:
                _plano.write(self.status_file, "FAILED\n")
                raise

        _plano.write(self.status_file, "PASSED\n")
Пример #7
0
    def run(self, port, args):
        _plano.make_dir(self.output_dir)

        command = [
            "quiver",
            "//127.0.0.1:{}/q0".format(port),
            "--sender",
            self.sender_impl,
            "--receiver",
            self.receiver_impl,
            "--messages",
            args.messages,
            "--body-size",
            args.body_size,
            "--credit",
            args.credit,
            "--timeout",
            args.timeout,
            "--output",
            self.output_dir,
        ]

        if self.peer_to_peer:
            command.append("--peer-to-peer")

        _plano.write(self.command_file, "{}\n".format(" ".join(command)))

        with open(self.output_file, "w") as f:
            try:
                _plano.call(command, stdout=f, stderr=f)
            except:
                _plano.write(self.status_file, "FAILED\n")
                raise

        _plano.write(self.status_file, "PASSED\n")
Пример #8
0
    def run(self, port, args):
        _plano.make_dir(self.output_dir)

        command = [
            "quiver",
            "--sender",
            self.sender_impl,
            "--receiver",
            self.receiver_impl,
            "--count",
            args.count,
            "--duration",
            args.duration,
            "--body-size",
            args.body_size,
            "--credit",
            args.credit,
            "--timeout",
            args.timeout,
        ]

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

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

        if not self.peer_to_peer:
            command += ["//localhost:{}/q0".format(port)]

        _plano.write(self.command_file, "{}\n".format(" ".join(command)))

        with open(self.output_file, "w") as f:
            try:
                _plano.call(command, stdout=f, stderr=f)
            except:
                _plano.write(self.status_file, "FAILED\n")
                raise

        _plano.write(self.status_file, "PASSED\n")