From 8f1f2834bea87ad5fcdbb91adff77d24da1c2be7 Mon Sep 17 00:00:00 2001 From: Erik Gafni Date: Mon, 11 Jul 2016 16:16:19 -0700 Subject: [PATCH] pretty print params on failure --- cosmos/models/Task.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cosmos/models/Task.py b/cosmos/models/Task.py index efe8e93e..8c68cb8b 100644 --- a/cosmos/models/Task.py +++ b/cosmos/models/Task.py @@ -15,6 +15,7 @@ from .. import TaskStatus, StageStatus, signal_task_status_change from ..util.helpers import wait_for_file import datetime +import pprint opj = os.path.join @@ -33,9 +34,10 @@ class GetOutputError(Exception): pass task_failed_printout = u"""Failure Info: - - + + +{0.params_pformat} + {0.command_script_text} @@ -326,8 +328,12 @@ def url(self): def params_pretty(self): return '%s' % ', '.join('%s=%s' % (k, "'%s'" % v if isinstance(v, basestring) else v) for k, v in self.params.items()) + @property + def params_pformat(self): + return pprint.pformat(self.params, indent=2, width=1) + def __repr__(self): - return '' % (self.id or 'id_%s' % id(self), + return "" % (self.id or 'id_%s' % id(self), self.stage.name if self.stage else '', self.uid )