[ARVADOS] updated: bc4e237bdbd23418fa21b7f13285deec2c079f0d

Git user git at public.curoverse.com
Wed Sep 6 17:20:42 EDT 2017


Summary of changes:
 .../crunchstat_summary/reader.py                   |  6 +++++
 .../crunchstat_summary/summarizer.py               | 26 +++++++++++-----------
 tools/crunchstat-summary/tests/test_examples.py    |  2 +-
 3 files changed, 20 insertions(+), 14 deletions(-)

       via  bc4e237bdbd23418fa21b7f13285deec2c079f0d (commit)
      from  56c5c336d1bbfd0af2b2d9ad20710d6bfe2d3186 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit bc4e237bdbd23418fa21b7f13285deec2c079f0d
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Sep 6 17:06:23 2017 -0400

    10472: Un-bork text reports.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/tools/crunchstat-summary/crunchstat_summary/reader.py b/tools/crunchstat-summary/crunchstat_summary/reader.py
index c215228..e8f0861 100644
--- a/tools/crunchstat-summary/crunchstat_summary/reader.py
+++ b/tools/crunchstat-summary/crunchstat_summary/reader.py
@@ -94,3 +94,9 @@ class LiveLogReader(object):
             self._thread.join()
             raise StopIteration
         return line
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, exc_type, exc_val, exc_tb):
+        pass
diff --git a/tools/crunchstat-summary/crunchstat_summary/summarizer.py b/tools/crunchstat-summary/crunchstat_summary/summarizer.py
index 6e08c5e..6552708 100644
--- a/tools/crunchstat-summary/crunchstat_summary/summarizer.py
+++ b/tools/crunchstat-summary/crunchstat_summary/summarizer.py
@@ -227,6 +227,8 @@ class Summarizer(object):
 
     def long_label(self):
         label = self.label
+        if hasattr(self, 'process') and self.process['uuid'] not in label:
+            label = '{} ({})'.format(label, self.process['uuid'])
         if self.finishtime:
             label += ' -- elapsed time '
             s = (self.finishtime - self.starttime).total_seconds()
@@ -528,10 +530,11 @@ class MultiSummarizer(object):
 
     def text_report(self):
         txt = ''
-        for cname, child in self._descendants():
-            if len(self.children) > 1:
+        d = self._descendants()
+        for cname, child in d.iteritems():
+            if len(d) > 1:
                 txt += '### Summary for {} ({})\n'.format(
-                    cname, child.process['uuid'])
+                    child.label, child.process['uuid'])
             txt += child.text_report()
             txt += '\n'
         return txt
@@ -539,12 +542,13 @@ class MultiSummarizer(object):
     def _descendants(self):
         """Dict of self and all descendants.
 
-        Wrappers with nothing of their own to report are omitted.
+        Nodes with nothing of their own to report (like
+        MultiSummarizers) are omitted.
         """
         d = collections.OrderedDict()
-        for cname, child in self.children.iteritems():
+        for key, child in self.children.iteritems():
             if isinstance(child, Summarizer):
-                d[cname] = child
+                d[key] = child
             if isinstance(child, MultiSummarizer):
                 d.update(child._descendants())
         return d
@@ -557,14 +561,10 @@ class JobTreeSummarizer(MultiSummarizer):
     """Summarizes a job and all children listed in its components field."""
     def __init__(self, job, label=None, **kwargs):
         arv = arvados.api('v1', model=OrderedJsonModel())
-        label = label or job.get('name', None)
-        if label is None:
-            label = job['uuid']
-        else:
-            label = ' '.join([label, job['uuid']])
+        label = label or job.get('name', job['uuid'])
         children = collections.OrderedDict()
         children[job['uuid']] = JobSummarizer(job, label=label, **kwargs)
-        if job['components']:
+        if job.get('components', None):
             preloaded = {}
             for j in arv.jobs().index(
                     limit=len(job['components']),
@@ -592,7 +592,7 @@ class PipelineSummarizer(MultiSummarizer):
             else:
                 logger.info(
                     "%s: job %s", cname, component['job']['uuid'])
-                summarizer = JobTreeSummarizer(component['job'], **kwargs)
+                summarizer = JobTreeSummarizer(component['job'], label=cname, **kwargs)
                 summarizer.label = '{} {}'.format(
                     cname, component['job']['uuid'])
                 children[cname] = summarizer
diff --git a/tools/crunchstat-summary/tests/test_examples.py b/tools/crunchstat-summary/tests/test_examples.py
index f5fde5f..ecc8b9d 100644
--- a/tools/crunchstat-summary/tests/test_examples.py
+++ b/tools/crunchstat-summary/tests/test_examples.py
@@ -180,7 +180,7 @@ class SummarizePipeline(ReportDiff):
             job_report + ['\n'] +
             ['### Summary for bar (zzzzz-8i9sb-000000000000001)\n'] +
             job_report + ['\n'] +
-            ['### Summary for unfinished-job (zzzzz-8i9sb-xxxxxxxxxxxxxxx)\n',
+            ['### Summary for unfinished-job (partial) (zzzzz-8i9sb-xxxxxxxxxxxxxxx)\n',
              '(no report generated)\n',
              '\n'] +
             ['### Summary for baz (zzzzz-8i9sb-000000000000002)\n'] +

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list