Esempio n. 1
0
    def _run_command(self, command_name: str, args: List[str]) -> None:
        command = self._command(command_name, args)
        process = ProcessManager(command)

        output = process.run_sync()

        if output.exit_code != 0:
            error = f"""Command `{command}` exited with non-zero code {output.exit_code}
            stdout: {output.stdout}
            stderr: {output.stderr}"""
            raise RuntimeError(error)
Esempio n. 2
0
    def run_dev(self) -> None:
        """Runs the node in the `run-dev` mode."""
        command = f"{self._app_name} run-dev -p {self._app_dir.path()} --clean"
        process = ProcessManager(command)
        process.start()

        self._processes.append(process)

        # Init metainfo, so you can work with run-dev node the same way
        # as you'll work with a properly initialized network.
        self._validators_count = 1
        self._public_api_addresses[0] = "127.0.0.1:8080"
        self._private_api_addresses[0] = "127.0.0.1:8081"
Esempio n. 3
0
    def run_node(self, validator_id: int) -> None:
        """Runs the node."""

        node_config = self._validator_config(validator_id, "node")
        db_path = self._db_path(validator_id)

        # {exonum_app} run --node-config example/1/node.toml --db-path example/1/db \
        # --public-api-address 0.0.0.0:8200 --master-key-pass pass
        args = [f"--node-config {node_config}"]
        args.append(f"--db-path {db_path}")
        args.append(f"--public-api-address {self._public_api_addresses[validator_id]}")
        args.append(f"--master-key-pass pass")

        command = f"{self._app_name} run " + " ".join(args)

        # Run the node in the separate thread.

        process = ProcessManager(command)
        process.start()

        self._processes.append(process)