r98215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98214‎ | r98215 | r98216 >
Date:10:12, 27 September 2011
Author:ariel
Status:deferred
Tags:
Comment:
quit generating dumps after n failures in a row (n = 3 for now), we probably have some serious problem
Modified paths:
  • /branches/ariel/xmldumps-backup/worker (modified) (history)
  • /branches/ariel/xmldumps-backup/worker.py (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/worker.py
@@ -1832,6 +1832,12 @@
18331833
18341834 self.showRunnerStateComplete()
18351835
 1836+ # let caller know if this was a successful run
 1837+ if self.status.failCount > 0:
 1838+ return False
 1839+ else:
 1840+ return True
 1841+
18361842 def cleanOldDumps(self):
18371843 if self._cleanOldDumpsEnabled:
18381844 old = self.wiki.dumpDirs()
@@ -3706,6 +3712,7 @@
37073713 chunkToDo = False
37083714 checkpointFile = None
37093715 pageIDRange = None
 3716+ result = False
37103717
37113718 try:
37123719 (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "",
@@ -3806,11 +3813,16 @@
38073814 print "Running %s, job %s..." % (wiki.dbName, jobRequested)
38083815 else:
38093816 print "Running %s..." % wiki.dbName
3810 - runner.run()
 3817+ result = runner.run()
38113818 # if we are doing one piece only of the dump, we don't unlock either
38123819 if locksEnabled:
38133820 wiki.unlock()
38143821 else:
38153822 print "No wikis available to run."
 3823+ result = True
38163824 finally:
38173825 WikiDump.cleanup()
 3826+ if result == False:
 3827+ sys.exit(1)
 3828+ else:
 3829+ sys.exit(0)
Index: branches/ariel/xmldumps-backup/worker
@@ -1,5 +1,10 @@
22 #!/bin/bash
33
 4+# number of failures of worker.py in a row before we decide
 5+# something serious is broken and we refuse to run
 6+MAXFAILS=3
 7+failures=0
 8+
49 WIKIDUMP_BASE=`dirname "$0"`
510
611 if [ ! -z "$1" ]; then
@@ -7,7 +12,7 @@
813 fi
914
1015 while true; do
11 - if [ -e "maintenance.txt" ]; then
 16+ if [ -e "$WIKIDUMP_BASE/maintenance.txt" ]; then
1217 echo "in maintenance mode, sleeping 5 minutes"
1318 sleep 300
1419 else
@@ -16,6 +21,13 @@
1722 else
1823 python $WIKIDUMP_BASE/worker.py
1924 fi
 25+ if [ $? -ne 0 ]; then
 26+ failures=$(($failures+1))
 27+ if [ $failures -gt $MAXFAILS ]; then
 28+ echo "more than $MAXFAILS failures in a row, halting."
 29+ exit 1
 30+ fi
 31+ fi
2032 echo "sleeping"
2133 sleep 30
2234 fi

Status & tagging log