From a507c7f72088fc4ccf48ea6f34482813c1fb9f81 Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Sun, 26 Feb 2017 19:19:38 +1300 Subject: [PATCH] Colorize statuses in parallel_execute output 'ok' displays in green 'error' displays in red Signed-off-by: Evan Shaw --- compose/parallel.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compose/parallel.py b/compose/parallel.py index e495410cf..cdeb07255 100644 --- a/compose/parallel.py +++ b/compose/parallel.py @@ -11,6 +11,8 @@ from six.moves import _thread as thread from six.moves.queue import Empty from six.moves.queue import Queue +from compose.cli.colors import green +from compose.cli.colors import red from compose.cli.signals import ShutdownException from compose.errors import HealthCheckFailed from compose.errors import NoHealthCheckConfigured @@ -45,16 +47,16 @@ def parallel_execute(objects, func, get_name, msg, get_deps=None): for obj, result, exception in events: if exception is None: - writer.write(get_name(obj), 'done') + writer.write(get_name(obj), green('done')) results.append(result) elif isinstance(exception, APIError): errors[get_name(obj)] = exception.explanation - writer.write(get_name(obj), 'error') + writer.write(get_name(obj), red('error')) elif isinstance(exception, (OperationFailedError, HealthCheckFailed, NoHealthCheckConfigured)): errors[get_name(obj)] = exception.msg - writer.write(get_name(obj), 'error') + writer.write(get_name(obj), red('error')) elif isinstance(exception, UpstreamError): - writer.write(get_name(obj), 'error') + writer.write(get_name(obj), red('error')) else: errors[get_name(obj)] = exception error_to_reraise = exception