[Piuparts-commits] [piuparts] 07/16: p-a: sort failed logfiles by age, process newest first

Holger Levsen holger at layer-acht.org
Thu Apr 13 15:04:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit a6b5f6f1364bd245f556bbd38cf83439d7ecf2de
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Apr 11 12:23:33 2017 +0200

    p-a: sort failed logfiles by age, process newest first
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog    | 1 +
 piuparts-analyze.py | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index b09de15..e40b598 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,7 @@ piuparts (0.77) UNRELEASED; urgency=medium
       distupgrade tests instead of generating it on-the-fly.
     - Flush pending logfiles upon startup.
   * piuparts-analyze.py:
+    - Process newest logfiles first, in case of timeouts.
   * piuparts-report.py:
     - Plot all states in the graphs.
     - Support new states in plots (varying number of columns in counts.txt).
diff --git a/piuparts-analyze.py b/piuparts-analyze.py
index 5286118..5d0ecca 100644
--- a/piuparts-analyze.py
+++ b/piuparts-analyze.py
@@ -49,8 +49,10 @@ distro = "?"
 
 
 def find_logs(directory):
-    return [os.path.join(directory, x)
+    """Returns list of logfiles sorted by age, newest first."""
+    logs = [os.path.join(directory, x)
             for x in os.listdir(directory) if x.endswith(".log")]
+    return [y[1] for y in reversed(sorted([(os.path.getmtime(x), x) for x in logs]))]
 
 
 def find_bugged_logs(failed_log):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list