From 571975e2fb9080c9482fdc4314ef65599d2c2d42 Mon Sep 17 00:00:00 2001
From: David Robert Verelst <dave@dtu.dk>
Date: Sun, 12 Jun 2016 15:03:18 +0200
Subject: [PATCH] launch: format time stamp for state log

---
 launch.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/launch.py b/launch.py
index 859cf3b..836c4e4 100755
--- a/launch.py
+++ b/launch.py
@@ -496,7 +496,10 @@ class Scheduler:
         f.close()
 
     def update_state_log(self, ts, cpu_user, cpu_free, cpu_user_queue):
-        line = [ts, self.nr_cpus, cpu_user, cpu_free, self.cpu_free,
+        ts_ = datetime.fromtimestamp(ts).strftime('%m-%d %H:%M:%S')
+        ms = '%1.02f' % ts
+        ts_ += ms[-3:]
+        line = [ts_, self.nr_cpus, cpu_user, cpu_free, self.cpu_free,
                 cpu_user_queue, self.cpu_user_queue, self.tsleep,
                 self.tsleep_short, self.pbs_update_deltat,
                 self.reload_pbsflist]
@@ -578,6 +581,8 @@ class Scheduler:
             # we only launch a new job when we are not using more than our
             # quota (nr_cpus), or when there is still some room for others
             # to breath
+            # TODO: add another metric: if the total queue is bigger than
+            # so many nodes/cpus, don't add anything else.
             if (self.nr_cpus > cpu_user) and (cpu_free > self.cpu_free) and \
                 (cpu_user_queue < self.cpu_user_queue):
 
-- 
GitLab