示例#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()
示例#2
0
文件: ghost.py 项目: 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)
示例#3
0
    def init(self):
        super(QuiverArrowCommand, self).init()

        self.operation = self.args.operation
        self.impl = self.get_arrow_impl_name(self.args.impl, self.args.impl)
        self.id_ = self.args.id
        self.connection_mode = "client"
        self.channel_mode = "active"
        self.prelude = _shlex.split(self.args.prelude)

        if self.operation == "send":
            self.role = "sender"
            self.transfers_parse_func = _parse_send
        elif self.operation == "receive":
            self.role = "receiver"
            self.transfers_parse_func = _parse_receive
        else:
            raise Exception()

        self.impl_file = self.get_arrow_impl_file(self.impl)

        if not _plano.exists(self.impl_file):
            raise CommandError("No implementation at '{}'", self.impl_file)

        if self.id_ is None:
            self.id_ = "quiver-{}".format(_plano.unique_id(4))

        if self.args.server:
            self.connection_mode = "server"

        if self.args.passive:
            self.channel_mode = "passive"

        self.init_url_attributes()
        self.init_common_test_attributes()
        self.init_common_tool_attributes()
        self.init_output_dir()

        self.snapshots_file = _join(self.output_dir,
                                    "{}-snapshots.csv".format(self.role))
        self.summary_file = _join(self.output_dir,
                                  "{}-summary.json".format(self.role))
        self.transfers_file = _join(self.output_dir,
                                    "{}-transfers.csv".format(self.role))

        self.start_time = None
        self.timeout_checkpoint = None

        self.first_send_time = None
        self.last_send_time = None
        self.first_receive_time = None
        self.last_receive_time = None
        self.message_count = None
        self.message_rate = None
        self.latency_average = None
        self.latency_quartiles = None
        self.latency_nines = None
示例#4
0
文件: arrow.py 项目: ssorj/quiver
    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)
示例#5
0
文件: ghost.py 项目: ssorj/ghost
    def status_command(self):
        _plano.enable_logging(level="warn")

        for repo_dir in self.args.repo_dir:
            if not _plano.exists(_plano.join(repo_dir, ".git")):
                continue

            _sys.stdout.write("## {:<40} ".format(repo_dir))

            with _plano.working_dir(repo_dir):
                output = _plano.call_for_stdout("git status -sb")

            _sys.stdout.write(output)
            _sys.stdout.flush()
示例#6
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)
示例#7
0
文件: ghost.py 项目: 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))
示例#8
0
    def init(self):
        super(QuiverServerCommand, self).init()

        self.impl = self.get_server_impl_name(self.args.impl, self.args.impl)
        self.ready_file = self.args.ready_file
        self.prelude = _shlex.split(self.args.prelude)
        self.init_only = self.args.init_only
        self.quiet = self.args.quiet
        self.verbose = self.args.verbose

        self.impl_file = self.get_server_impl_file(self.impl)

        if not _plano.exists(self.impl_file):
            raise CommandError("No implementation at '{}'", self.impl_file)

        if self.ready_file is None:
            self.ready_file = "-"

        self.init_url_attributes()
示例#9
0
 def clean(self):
     if _plano.exists(_join(self.work_dir, "Makefile")):
         with _working_dir(self.work_dir):
             _call("make clean")
示例#10
0
 def clean(self):
     if _plano.exists(_join(self.work_dir, "pom.xml")):
         with _working_dir(self.work_dir):
             _call("mvn -B -q clean", shell=True)