From: Tom Morris Date: Tue, 5 Dec 2017 00:00:14 +0000 (-0500) Subject: 12690: Report Keep stats for Crunch2 container requests. X-Git-Tag: 1.3.0~93^2~3 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3b614c40ade5a5d7d2a9f0923bfbeaaa25573baf 12690: Report Keep stats for Crunch2 container requests. Arvados-DCO-1.1-Signed-off-by: Tom Morris --- diff --git a/tools/crunchstat-summary/crunchstat_summary/reader.py b/tools/crunchstat-summary/crunchstat_summary/reader.py index 98dda673d5..5db7e75eb3 100644 --- a/tools/crunchstat-summary/crunchstat_summary/reader.py +++ b/tools/crunchstat-summary/crunchstat_summary/reader.py @@ -5,6 +5,7 @@ from __future__ import print_function import arvados +import itertools import Queue import threading import _strptime @@ -16,7 +17,7 @@ class CollectionReader(object): def __init__(self, collection_id): self._collection_id = collection_id self._label = collection_id - self._reader = None + self._readers = [] def __str__(self): return self._label @@ -25,21 +26,22 @@ class CollectionReader(object): logger.debug('load collection %s', self._collection_id) collection = arvados.collection.CollectionReader(self._collection_id) filenames = [filename for filename in collection] - if len(filenames) == 1: - filename = filenames[0] - else: - filename = 'crunchstat.txt' - self._label = "{}/{}".format(self._collection_id, filename) - self._reader = collection.open(filename) - return iter(self._reader) + # Crunch2 has multiple stats files + if len(filenames) > 1: + filenames = ['crunchstat.txt', 'arv-mount.txt'] + for filename in filenames: + self._readers.append(collection.open(filename)) + self._label = "{}/{}".format(self._collection_id, filenames[0]) + return itertools.chain(*[iter(reader) for reader in self._readers]) def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): - if self._reader: - self._reader.close() - self._reader = None + if self._readers: + for reader in self._readers: + reader.close() + self._readers = [] class LiveLogReader(object): diff --git a/tools/crunchstat-summary/crunchstat_summary/summarizer.py b/tools/crunchstat-summary/crunchstat_summary/summarizer.py index d91161c70c..ea30d0c549 100644 --- a/tools/crunchstat-summary/crunchstat_summary/summarizer.py +++ b/tools/crunchstat-summary/crunchstat_summary/summarizer.py @@ -115,12 +115,14 @@ class Summarizer(object): logger.debug('%s: done %s', self.label, uuid) continue + # 2017-12-02_17:15:08 e51c5-8i9sb-mfp68stkxnqdd6m 63676 0 stderr crunchstat: keepcalls 0 put 2576 get -- interval 10.0000 seconds 0 put 2576 get m = re.search(r'^(?P[^\s.]+)(\.\d+)? (?P\S+) \d+ (?P\d+) stderr crunchstat: (?P\S+) (?P.*?)( -- interval (?P.*))?\n$', line) if not m: continue else: # crunch2 - m = re.search(r'^(?P\S+) (?P\S+) (?P.*?)( -- interval (?P.*))?\n$', line) + # 2017-12-01T16:56:24.723509200Z crunchstat: keepcalls 0 put 3 get -- interval 10.0000 seconds 0 put 3 get + m = re.search(r'^(?P\S+) (crunchstat: )?(?P\S+) (?P.*?)( -- interval (?P.*))?\n$', line) if not m: continue