X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b3bb4cdff0b10f42624b67ae19c03f1edfcecab0..207136fe4f9787ac7f99cba448ed5a2a05a6f8dd:/tools/crunchstat-summary/crunchstat_summary/summarizer.py diff --git a/tools/crunchstat-summary/crunchstat_summary/summarizer.py b/tools/crunchstat-summary/crunchstat_summary/summarizer.py index d058c232ac..a88e4d5c41 100644 --- a/tools/crunchstat-summary/crunchstat_summary/summarizer.py +++ b/tools/crunchstat-summary/crunchstat_summary/summarizer.py @@ -11,6 +11,7 @@ import math import re import sys import threading +import _strptime from arvados.api import OrderedJsonModel from crunchstat_summary import logger @@ -21,6 +22,11 @@ from crunchstat_summary import logger AVAILABLE_RAM_RATIO = 0.95 +# Workaround datetime.datetime.strptime() thread-safety bug by calling +# it once before starting threads. https://bugs.python.org/issue7980 +datetime.datetime.strptime('1999-12-31_23:59:59', '%Y-%m-%d_%H:%M:%S') + + class Task(object): def __init__(self): self.starttime = None @@ -336,19 +342,20 @@ class Summarizer(object): int(math.ceil(nearlygibs(used_mib))*AVAILABLE_RAM_RATIO*1024)) def _recommend_keep_cache(self): - """Recommend increasing keep cache if miss rate is above 0.2%""" - if self.job_tot['keepcalls']['get'] == 0: + """Recommend increasing keep cache if utilization < 80%""" + if self.job_tot['net:keep0']['rx'] == 0: return - miss_rate = float(self.job_tot['keepcache']['miss']) / float(self.job_tot['keepcalls']['get']) * 100.0 + utilization = (float(self.job_tot['blkio:0:0']['read']) / + float(self.job_tot['net:keep0']['rx'])) asked_mib = self.existing_constraints.get('keep_cache_mb_per_task', 256) - if miss_rate > 0.2: + if utilization < 0.8: yield ( - '#!! {} Keep cache miss rate was {:.2f}% -- ' - 'try runtime_constraints "keep_cache_mb_per_task":{}' + '#!! {} Keep cache utilization was {:.2f}% -- ' + 'try runtime_constraints "keep_cache_mb_per_task":{} (or more)' ).format( self.label, - miss_rate, + utilization * 100.0, asked_mib*2)