19744: Remove specific recommendations
authorPeter Amstutz <peter.amstutz@curii.com>
Wed, 28 Feb 2024 19:27:52 +0000 (14:27 -0500)
committerPeter Amstutz <peter.amstutz@curii.com>
Wed, 28 Feb 2024 19:27:52 +0000 (14:27 -0500)
Still want to note inefficient CPU/RAM usage.

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/arvcontainer.py
sdk/cwl/arvados_cwl/context.py
sdk/cwl/arvados_cwl/executor.py
tools/crunchstat-summary/crunchstat_summary/summarizer.py

index d4b1e0050dda2a35a2e007bf47bff1c4d4fd1c3f..f048e505e8ea0b6d348b2a619798221e843267bc 100644 (file)
@@ -548,7 +548,7 @@ class ArvadosContainer(JobBase):
 
                     # Post warnings about nodes that are under-utilized.
                     for rc in summarizer._recommend_gen(lambda x: x):
-                        logger.warning(x)
+                        self.usage_report_notes.append(rc)
 
                 except Exception as e:
                     logger.warning("%s unable to generate resource usage report",
index a90a6d48c33bf800dd5a8d285e3a80fd615b0703..60ea9bdff50b5c6e46bcfa6381edc662952e15a3 100644 (file)
@@ -47,6 +47,7 @@ class ArvRuntimeContext(RuntimeContext):
         self.print_keep_deps = False
         self.git_info = {}
         self.enable_usage_report = None
+        self.usage_report_notes = []
 
         super(ArvRuntimeContext, self).__init__(kwargs)
 
index 1b484a17208a9aadf9a98fccc73918d940a724f7..28ee60ac3973b5103a7cc71c97836bc562347cc7 100644 (file)
@@ -929,6 +929,11 @@ The 'jobs' API is no longer supported.
         if self.final_output is None:
             raise WorkflowException("Workflow did not return a result.")
 
+        if runtimeContext.usage_report_notes:
+            logger.info("Resource report notifications:")
+            for x in runtimeContext.usage_report_notes:
+                logger.info("  %s", x)
+
         if runtimeContext.submit and isinstance(tool, Runner):
             logger.info("Final output collection %s", tool.final_output)
             if workbench2 or workbench1:
index a7c2b0a3831c7f667adb1435ce8ce0cfccfb91c5..8a2cda130b331c20807f7039e40576b547aefb3a 100644 (file)
@@ -421,16 +421,14 @@ class Summarizer(object):
         asked_cores = self.existing_constraints.get(constraint_key)
         if asked_cores is None:
             asked_cores = 1
-        # TODO: This should be more nuanced in cases where max >> avg
+
         if used_cores < (asked_cores*.5):
             yield recommendformat(
-                '{} max CPU usage was {}% -- '
-                'try reducing runtime_constraints to "{}":{}'
+                '{} peak CPU usage was only {}% out of possible {}% ({} cores requested)'
             ).format(
                 self.label,
                 math.ceil(cpu_max_rate*100),
-                constraint_key,
-                int(used_cores))
+                asked_cores*100, asked_cores)
 
     # FIXME: This needs to be updated to account for current a-d-c algorithms
     def _recommend_ram(self, recommendformat):
@@ -482,14 +480,12 @@ class Summarizer(object):
         recommend_mib = int(math.ceil(nearlygibs(used_mib/ratio))*AVAILABLE_RAM_RATIO*1024)
         if used_mib > 0 and (used_mib / asked_mib) < ratio and asked_mib > recommend_mib:
             yield recommendformat(
-                '{} requested {} MiB of RAM but actual RAM usage was below {}% at {} MiB -- '
-                'suggest reducing RAM request to {} MiB'
+                '{} peak RAM usage was only {}% ({} MiB used / {} MiB requested)'
             ).format(
                 self.label,
-                int(asked_mib),
-                int(100*ratio),
+                int(100*(used_mib / asked_mib)),
                 int(used_mib),
-                recommend_mib)
+                int(asked_mib))
 
     def _recommend_keep_cache(self, recommendformat):
         """Recommend increasing keep cache if utilization < 50%.
@@ -499,7 +495,6 @@ class Summarizer(object):
         arv-mount.
         """
 
-        constraint_key = self._map_runtime_constraint('keep_cache_ram')
         if self.job_tot['net:keep0']['rx'] == 0:
             return
         utilization = (float(self.job_tot['blkio:0:0']['read']) /
@@ -510,11 +505,10 @@ class Summarizer(object):
         if utilization < 0.5:
             yield recommendformat(
                 '{} Keep cache utilization was {:.2f}% -- '
-                'try increasing keep_cache to {} MB'
+                'recommend increasing keep_cache'
             ).format(
                 self.label,
-                utilization * 100.0,
-                math.ceil((asked_cache * 2) / (1024*1024)))
+                utilization * 100.0)
 
 
     def _recommend_temp_disk(self, recommendformat):