From da66ecf21c5b13a66ee68ba725b16b86307a1658 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Fri, 3 Apr 2020 15:47:44 -0700 Subject: [PATCH] Cleanup ursula startup console output; Improve accuracy. --- nucypher/blockchain/eth/actors.py | 4 +--- nucypher/characters/lawful.py | 15 +++++++++++++-- nucypher/cli/actions.py | 2 +- nucypher/cli/processes.py | 12 +----------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/nucypher/blockchain/eth/actors.py b/nucypher/blockchain/eth/actors.py index 8a3834617..0bfa2667e 100644 --- a/nucypher/blockchain/eth/actors.py +++ b/nucypher/blockchain/eth/actors.py @@ -1283,7 +1283,7 @@ class Worker(NucypherTokenActor): start = maya.now() emitter = StdoutEmitter() # TODO: Make injectable, or embed this logic into Ursula - emitter.message("Waiting for bonding and funding...") + emitter.message("Waiting for bonding and funding...", color='yellow') funded, bonded = False, False while True: @@ -1308,8 +1308,6 @@ class Worker(NucypherTokenActor): # TODO: #1823 - Workaround for new nickname every restart self.nickname, self.nickname_metadata = nickname_from_seed(self.checksum_address) - - emitter.message(f"Starting services...", color='yellow', bold=True) break # Crash on Timeout diff --git a/nucypher/characters/lawful.py b/nucypher/characters/lawful.py index d08db8d44..46b1b40ef 100644 --- a/nucypher/characters/lawful.py +++ b/nucypher/characters/lawful.py @@ -1116,19 +1116,28 @@ class Ursula(Teacher, Character, Worker): # Async loops ordered by schedule priority # + if emitter: + emitter.message(f"Starting services...", color='yellow') + if pruning: self.__pruning_task = self._arrangement_pruning_task.start(interval=self._pruning_interval, now=True) + if emitter: + emitter.message(f" ✓ Database pruning", color='green') if learning: - if emitter: - emitter.message(f"Connecting to {','.join(self.learning_domains)}", color='green', bold=True) self.start_learning_loop(now=self._start_learning_now) + if emitter: + emitter.message(f" ✓ Node Discovery ({','.join(self.learning_domains)})", color='green') if self._availability_check and availability: self._availability_sensor.start(now=False) # wait... + if emitter: + emitter.message(f" ✓ Availability Checks", color='green') if worker and not self.federated_only: self.work_tracker.start(act_now=True, requirement_func=self._availability_sensor.status) + if emitter: + emitter.message(f" ✓ Work Tracking", color='green') # # Non-order dependant services @@ -1139,6 +1148,8 @@ class Ursula(Teacher, Character, Worker): # Local scoped to help prevent import without prometheus installed from nucypher.utilities.metrics import initialize_prometheus_exporter initialize_prometheus_exporter(ursula=self, port=self._metrics_port) + if emitter: + emitter.message(f" ✓ Prometheus Exporter", color='green') if interactive and emitter: stdio.StandardIO(UrsulaCommandProtocol(ursula=self, emitter=emitter)) diff --git a/nucypher/cli/actions.py b/nucypher/cli/actions.py index 3a888c230..f58f2991a 100644 --- a/nucypher/cli/actions.py +++ b/nucypher/cli/actions.py @@ -108,7 +108,7 @@ def get_nucypher_password(confirm: bool = False, envvar=NUCYPHER_ENVVAR_KEYRING_ def unlock_nucypher_keyring(emitter, password: str, character_configuration: CharacterConfiguration): - emitter.message('Decrypting NuCypher keyring...', color='yellow') + emitter.message(f'Decrypting {character_configuration._NAME} keyring...', color='yellow') if character_configuration.dev_mode: return True # Dev accounts are always unlocked diff --git a/nucypher/cli/processes.py b/nucypher/cli/processes.py index b25e2c09a..adb83c3a5 100644 --- a/nucypher/cli/processes.py +++ b/nucypher/cli/processes.py @@ -120,14 +120,6 @@ class UrsulaCommandProtocol(LineReceiver): self.emitter.echo(line) def connectionMade(self): - - message = 'Attached {}@{}'.format( - self.ursula.checksum_address, - self.ursula.rest_url()) - - self.emitter.echo(message, color='green') - self.emitter.echo('{} | {}'.format(self.ursula.nickname_icon, self.ursula.nickname), color='blue', bold=True) - self.emitter.echo("\nType 'help' or '?' for help") self.transport.write(self.prompt) @@ -135,9 +127,7 @@ class UrsulaCommandProtocol(LineReceiver): self.ursula.stop_learning_loop(reason=reason) def lineReceived(self, line): - """ - Ursula Console REPL - """ + """Ursula Console REPL""" # Read raw_line = line.decode(encoding=self.encoding)