Cleanup ursula startup console output; Improve accuracy.

pull/1839/head
Kieran Prasch 2020-04-03 15:47:44 -07:00
parent 64d912c43c
commit da66ecf21c
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
4 changed files with 16 additions and 17 deletions

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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)