20735: Merge branch 'main' into 20735-update-deps
[arvados.git] / tools / crunchstat-summary / crunchstat_summary / summarizer.py
index 3780ef783d45b10aab9d24f77dba2cd40cb53ec6..a876257abc2a5ae00c8def17f4ae23e0219de446 100644 (file)
@@ -4,7 +4,6 @@
 
 import arvados
 import collections
-import arvados.util
 import crunchstat_summary.dygraphs
 import crunchstat_summary.reader
 import datetime
@@ -246,6 +245,27 @@ class Summarizer(object):
                     self.job_tot[category][stat] += val
         logger.debug('%s: done totals', self.label)
 
+        missing_category = {
+            'cpu': 'CPU',
+            'mem': 'memory',
+            'net:': 'network I/O',
+            'statfs': 'storage space',
+        }
+        for task_stat in self.task_stats.values():
+            for category in task_stat.keys():
+                for checkcat in missing_category:
+                    if checkcat.endswith(':'):
+                        if category.startswith(checkcat):
+                            missing_category.pop(checkcat)
+                            break
+                    else:
+                        if category == checkcat:
+                            missing_category.pop(checkcat)
+                            break
+        for catlabel in missing_category.values():
+            logger.warning('%s: %s stats are missing -- possible cluster configuration issue',
+                        self.label, catlabel)
+
     def long_label(self):
         label = self.label
         if hasattr(self, 'process') and self.process['uuid'] not in label:
@@ -365,7 +385,7 @@ class Summarizer(object):
                 constraint_key,
                 int(used_cores))
 
-    # FIXME: This needs to be updated to account for current nodemanager algorithms
+    # FIXME: This needs to be updated to account for current a-d-c algorithms
     def _recommend_ram(self):
         """Recommend an economical RAM constraint for this job.
 
@@ -537,7 +557,7 @@ class ProcessSummarizer(Summarizer):
         # Pre-Arvados v1.4 everything is in 'log'
         # For 1.4+ containers have no logs and container_requests have them in 'log_uuid', not 'log'
         log_collection = self.process.get('log', self.process.get('log_uuid'))
-        if log_collection and self.process.get('state') != arvados.util.CR_UNCOMMITTED:
+        if log_collection and self.process.get('state') != 'Uncommitted': # arvados.util.CR_UNCOMMITTED:
             try:
                 rdr = crunchstat_summary.reader.CollectionReader(log_collection)
             except arvados.errors.NotFoundError as e: