Esempio n. 1
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            "host={}".format(self.host),
            "port={}".format(self.port),
            "path={}".format(self.path),
            "ready-file={}".format(self.ready_file),
        ]

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

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

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

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

        if self.trusted_db:
            args.append("trusted-db={}".format(self.trusted_db))

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

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

        _plano.call(args)
Esempio n. 2
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()
Esempio n. 3
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")
Esempio n. 4
0
File: ghost.py Progetto: ssorj/ghost
    def clone_command(self):
        _plano.enable_logging(level="warn")

        if _plano.exists(self.args.repo_name):
            exit("Path already exists")

        _plano.call("git clone [email protected]:{}/{}.git", self.args.user, self.args.repo_name)
Esempio n. 5
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            "host={}".format(self.host),
            "port={}".format(self.port),
            "path={}".format(self.path),
            "ready-file={}".format(self.ready_file),
        ]

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

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

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

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

        if self.trust_store:
            args.append("trust-store={}".format(self.trust_store))

        if self.quiet:
            args.append("quiet=1")

        if self.verbose:
            args.append("verbose=1")

        _plano.call(args)
Esempio n. 6
0
    def run(self):
        args = self.prelude + [
            self.impl.file,
            "host={}".format(self.host),
            "port={}".format(self.port),
            "path={}".format(self.path),
            "ready-file={}".format(self.ready_file),
        ]

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

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

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

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

        if self.trusted_db:
            args.append("trusted-db={}".format(self.trusted_db))

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

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

        _plano.call(args)
Esempio 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")
Esempio n. 8
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)
Esempio n. 9
0
    def run(self):
        args = self.prelude + [
            self.impl_file,
            self.host,
            self.port,
            self.path,
            self.ready_file,
        ]

        assert None not in args, args

        _plano.call(args)
Esempio n. 10
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)
Esempio n. 11
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")
Esempio n. 12
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.messages),
            str(self.body_size),
            str(self.credit_window),
        ]

        assert None not in args, args

        with open(self.transfers_file, "wb") as fout:
            _plano.notice("Calling '{}'", " ".join(args))

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

            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 _os.path.getsize(self.transfers_file) == 0:
            raise CommandError("No transfers")

        self.compute_results()
        self.save_summary()

        _plano.call("xz --compress -0 --threads 0 {}", self.transfers_file)
Esempio n. 13
0
File: ghost.py Progetto: ssorj/ghost
    def init_command(self):
        _plano.enable_logging(level="warn")

        if _plano.exists(_plano.join(self.args.repo_dir, ".git")):
            self.fail("The directory is already initialized")

        repo_name = _plano.file_name(self.args.repo_dir)

        with _plano.working_dir(self.args.repo_dir):
            _plano.call("git init")
            _plano.call("git add .")
            _plano.call("git commit -m \"Initial commit\"")
            _plano.call("git remote add origin [email protected]:{}/{}.git", self.args.user, repo_name)

            print("Make sure this repo exists on GitHub and then push:")
            print("git push -u origin/{}".format(repo_name))