[Piuparts-commits] [piuparts] 01/01: generate_daily_report.in: measure runtime of this script and the scripts started by it.

Holger Levsen holger at layer-acht.org
Tue Mar 7 11:09:19 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 a4b3ae604467c8e48aac86219c4ff55c791338cd
Author: Holger Levsen <holger at layer-acht.org>
Date:   Tue Mar 7 12:09:08 2017 +0100

    generate_daily_report.in: measure runtime of this script and the scripts started by it.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog                     |  2 ++
 master-bin/detect_piuparts_issues.in |  6 +-----
 master-bin/generate_daily_report.in  | 13 ++++++++++---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f826986..45ec0c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -76,6 +76,8 @@ piuparts (0.76) UNRELEASED; urgency=medium
     exclude it from backups made by DSA.
   * conf/crontab-master.in: try to run piuparts-report three times a day
     instead of four, which hasn't worked out for a long time.
+  * generate_daily_report.in: measure runtime of this script and the scripts
+    started by it.
 
   [ Michael Stapelberg ]
   * Add support for logging update-alternatives calls using optional
diff --git a/master-bin/detect_piuparts_issues.in b/master-bin/detect_piuparts_issues.in
index 059046c..d41305f 100755
--- a/master-bin/detect_piuparts_issues.in
+++ b/master-bin/detect_piuparts_issues.in
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2009 Holger Levsen (holger at layer-acht.org)
+# Copyright © 2009-2017 Holger Levsen (holger at layer-acht.org)
 # Copyright © 2011-2017 Andreas Beckmann (anbe at debian.org)
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@ get_config_value SECTIONS global sections
 # detect piuparts problems
 #
 
-BEGIN=$(date -u)
 FILE=`mktemp`
 for SECTION in $SECTIONS ; do
 	test -d $MASTER/$SECTION || continue
@@ -71,14 +70,11 @@ for SECTION in $SECTIONS ; do
 		find $MASTER/$SECTION/$subdir -name '*.log' -size 0 >> $FILE
 	done
 done
-END=$(date -u)
 if [ -s $FILE ] ; then
 	echo "piuparts problem detected!"
 	echo "(By grep'ing for 'tar: .*.tar.gz: Cannot open: No such file or directory'"
 	echo "and for some python errors and tracebacks in failed logs.)"
 	echo
-	echo "Begin: $BEGIN  End: $END"
-	echo
 	echo "Please review the following logfiles/packages."
         echo "If it is always the same package failing, it's likely to be an issue in the"
 	echo "package."
diff --git a/master-bin/generate_daily_report.in b/master-bin/generate_daily_report.in
index d6483e3..1a66bbb 100755
--- a/master-bin/generate_daily_report.in
+++ b/master-bin/generate_daily_report.in
@@ -36,14 +36,19 @@ if [ -e $LOCKFILE ]; then
 fi
 date > $LOCKFILE
 
+R_STARTDATE=$(date -u +%s)
+
 #
 # various scripts to detect issues and cleanup
 #
 OUTPUT=$(mktemp)
 for SCRIPT in detect_network_issues detect_piuparts_issues archive_old_logs report_newly_bugged_packages ; do
+  STARTDATE=$(date -u +%s)
   @sharedir@/piuparts/master/$SCRIPT 2>&1 > $OUTPUT
+  FINALDATE=$(date -u +%s)
   if [ -s $OUTPUT ] ; then
-	cat $OUTPUT | mail -s $SCRIPT $LOGNAME
+	RUNTIME=$(date -u -d "$FINALDATE seconds - $STARTDATE seconds" +%T)
+	( echo -e "Runtime: $RUNTIME\n" ; cat $OUTPUT ) | mail -s $SCRIPT $LOGNAME
   fi
 done
 rm $OUTPUT
@@ -91,9 +96,11 @@ if [ -s $expire ]; then
 	rm -f $(cat $expire) >> $DAILYREPORT
 fi
 rm $expire
-date >> $DAILYREPORT
 
-cat $DAILYREPORT | mail -s piuparts-report $LOGNAME
+FINALDATE=$(date -u +%s)
+RUNTIME=$(date -u -d "$FINALDATE seconds - $R_STARTDATE seconds" +%T)
+
+( echo -e "Runtime: $RUNTIME\n" ; cat $DAILYREPORT ) | mail -s piuparts-report $LOGNAME
 
 mv $FAILURESTAMP.new $FAILURESTAMP
 rm -f $LOCKFILE

-- 
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