Exemplo n.º 1
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            "connection-mode={}".format(self.connection_mode),
            "channel-mode={}".format(self.channel_mode),
            "operation={}".format(self.operation),
            "id={}".format(self.id_),
            "scheme={}".format(self.scheme),
            "host={}".format(self.host),
            "port={}".format(self.port),
            "path={}".format(self.path),
            "duration={}".format(self.duration),
            "count={}".format(self.count),
            "rate={}".format(self.rate),
            "body-size={}".format(self.body_size),
            "credit-window={}".format(self.credit_window),
            "transaction-size={}".format(self.transaction_size),
            "durable={}".format(1 if self.durable else 0),
        ]

        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.append("key={}".format(self.key))
            args.append("cert={}".format(self.cert))

        with open(self.transfers_file, "wb") as fout:
            env = _plano.ENV

            if self.verbose:
                env["QUIVER_VERBOSE"] = "1"

            proc = _plano.start_process(args, stdout=fout, env=env)

            try:
                self.monitor_subprocess(proc)
            except:
                _plano.stop_process(proc)
                raise

            if proc.returncode != 0:
                raise CommandError("{} exited with code {}", self.role, proc.returncode)

        if _plano.file_size(self.transfers_file) == 0:
            raise CommandError("No transfers")

        self.compute_results()
        self.save_summary()

        if _plano.exists("{}.xz".format(self.transfers_file)):
            _plano.remove("{}.xz".format(self.transfers_file))

        _plano.call("xz --compress -0 --threads 0 {}", self.transfers_file)

        if (self.args.summary):
            self.print_summary()
Exemplo n.º 2
0
    def init(self):
        super(QuiverBenchCommand, self).init()

        self.output_dir = self.args.output

        if self.output_dir is None:
            prefix = _plano.program_name()
            datestamp = _time.strftime('%Y-%m-%d', _time.localtime())

            self.output_dir = "{}-{}".format(prefix, datestamp)

        _plano.remove(self.output_dir)
        _plano.make_dir(self.output_dir)

        self.client_server = True
        self.peer_to_peer = True

        if self.args.client_server:
            self.peer_to_peer = False

        if self.args.peer_to_peer:
            self.client_server = False

        self.mixed_pairs = self.args.mixed_pairs

        self.init_impl_attributes()
        self.init_common_test_attributes()
        self.init_common_tool_attributes()

        _plano.set_message_threshold("warn")

        self.failures = list()
Exemplo n.º 3
0
    def build(self):
        _plano.remove(self.work_dir)
        _plano.copy(self.source_dir, self.work_dir)

        # Remove any leftover build output from the source dir
        _plano.remove(_plano.join(self.work_dir, "build"))

        self.clean()
Exemplo n.º 4
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            "connection-mode={}".format(self.connection_mode),
            "channel-mode={}".format(self.channel_mode),
            "operation={}".format(self.operation),
            "id={}".format(self.id_),
            "scheme={}".format(self.scheme),
            "host={}".format(self.host),
            "port={}".format(self.port),
            "path={}".format(self.path),
            "duration={}".format(self.duration),
            "count={}".format(self.count),
            "body-size={}".format(self.body_size),
            "credit-window={}".format(self.credit_window),
            "transaction-size={}".format(self.transaction_size),
            "durable={}".format(1 if self.durable else 0),
        ]

        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.append("key={}".format(self.key))
            args.append("cert={}".format(self.cert))

        with open(self.transfers_file, "wb") as fout:
            env = _plano.ENV

            if self.verbose:
                env["QUIVER_VERBOSE"] = "1"

            proc = _plano.start_process(args, stdout=fout, env=env)

            try:
                self.monitor_subprocess(proc)
            except:
                _plano.stop_process(proc)
                raise

            if proc.returncode != 0:
                raise CommandError("{} exited with code {}", self.role, proc.returncode)

        if _plano.file_size(self.transfers_file) == 0:
            raise CommandError("No transfers")

        self.compute_results()
        self.save_summary()

        if _plano.exists("{}.xz".format(self.transfers_file)):
            _plano.remove("{}.xz".format(self.transfers_file))

        _plano.call("xz --compress -0 --threads 0 {}", self.transfers_file)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            self.connection_mode,
            self.channel_mode,
            self.operation,
            self.id_,
            self.host,
            self.port,
            self.path,
            str(self.duration),
            str(self.count),
            str(self.body_size),
            str(self.credit_window),
            str(self.transaction_size),
            self.flags,
        ]

        assert None not in args, args

        with open(self.transfers_file, "wb") as fout:
            env = _plano.ENV

            if self.verbose:
                env["QUIVER_VERBOSE"] = "1"

            proc = _plano.start_process(args, stdout=fout, env=env)

            try:
                self.monitor_subprocess(proc)
            except:
                _plano.stop_process(proc)
                raise

            if proc.returncode != 0:
                raise CommandError("{} exited with code {}", self.role,
                                   proc.returncode)

        if _plano.file_size(self.transfers_file) == 0:
            raise CommandError("No transfers")

        self.compute_results()
        self.save_summary()

        if _plano.exists("{}.xz".format(self.transfers_file)):
            _plano.remove("{}.xz".format(self.transfers_file))

        _plano.call("xz --compress -0 --threads 0 {}", self.transfers_file)
Exemplo n.º 8
0
 def clean(self):
     with _working_dir(self.work_dir):
         for path in _plano.find("*.pyc"):
             _plano.remove(path)
Exemplo n.º 9
0
 def clean(self):
     for path in _plano.find(self.work_dir, "*.csproj"):
         project_dir = _plano.get_parent_dir(path)
         _plano.remove(_join(self.work_dir, project_dir, "bin"))
         _plano.remove(_join(self.work_dir, project_dir, "obj"))
Exemplo n.º 10
0
    def build(self):
        _plano.remove(self.work_dir)
        _plano.copy(self.source_dir, self.work_dir)

        self.clean()