r86330 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86329‎ | r86330 | r86331 >
Date:18:09, 18 April 2011
Author:ariel
Status:deferred
Tags:
Comment:
remove checkpoint option and code, dead. remove my bad change to xmlescape
Modified paths:
  • /branches/ariel/xmldumps-backup/worker.py (modified) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/worker.py
@@ -21,13 +21,11 @@
2222
2323 from os.path import dirname, exists, getsize, join, realpath
2424 from subprocess import Popen, PIPE
25 -#from WikiDump import FileUtils, DirUtils, MiscUtils, prettyTime, prettySize, shellEscape
2625 from WikiDump import FileUtils, MiscUtils, TimeUtils
2726 from CommandManagement import CommandPipeline, CommandSeries, CommandsInParallel
2827
29 -# FIXME test this change.
3028 def xmlEscape(text):
31 - return text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;");
 29+ return text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
3230
3331 class Logger(object):
3432
@@ -844,7 +842,7 @@
845843
846844 class Runner(object):
847845
848 - def __init__(self, wiki, date=None, checkpoint=None, prefetch=True, spawn=True, job=None, restart=False, loggingEnabled=False):
 846+ def __init__(self, wiki, date=None, prefetch=True, spawn=True, job=None, restart=False, loggingEnabled=False):
849847 self.wiki = wiki
850848 self.config = wiki.config
851849 self.dbName = wiki.dbName
@@ -864,8 +862,6 @@
865863
866864 self.lastFailed = False
867865
868 - self.checkpoint = checkpoint
869 -
870866 self.jobRequested = job
871867 self.dbServerInfo = DbServerInfo(self.wiki, self.dbName, self.logAndPrint)
872868
@@ -1060,15 +1056,6 @@
10611057 item.start(self)
10621058 self.status.updateStatusFiles()
10631059 self.dumpItemList.saveDumpRunInfoFile()
1064 - # FIXME is this checkpoint stuff useful to us now?
1065 - if self.checkpoint and not item.matchCheckpoint(self.checkpoint):
1066 - self.debug("*** Skipping until we reach checkpoint...")
1067 - item.setStatus("done")
1068 - pass
1069 - else:
1070 - if self.checkpoint and item.matchCheckpoint(self.checkpoint):
1071 - self.debug("*** Reached checkpoint!")
1072 - self.checkpoint = None
10731060 try:
10741061 item.dump(self)
10751062 except Exception, ex:
@@ -1134,22 +1121,14 @@
11351122 except:
11361123 # failure? let it die
11371124 pass
1138 - #####date -u > $StatusLockFile
11391125
11401126 def unlock(self):
11411127 self.showRunnerState("Marking complete.")
1142 - ######date -u > $StatusDoneFile
11431128
1144 - def dateStamp(self):
1145 - #date -u --iso-8601=seconds
1146 - pass
1147 -
11481129 def showRunnerState(self, message):
1149 - #echo $DatabaseName `dateStamp` OK: "$1" | tee -a $StatusLog | tee -a $GlobalLog
11501130 self.debug(message)
11511131
11521132 def showRunnerStateComplete(self):
1153 - # echo $DatabaseName `dateStamp` SUCCESS: "done." | tee -a $StatusLog | tee -a $GlobalLog
11541133 self.debug("SUCCESS: done.")
11551134
11561135 def completeDump(self, files):
@@ -1294,9 +1273,6 @@
12951274 def waitAlarmHandler(self, signum, frame):
12961275 pass
12971276
1298 - def matchCheckpoint(self, checkpoint):
1299 - return checkpoint == self.__class__.__name__
1300 -
13011277 def buildRecombineCommandString(self, runner, files, outputFileBasename, compressionCommand, uncompressionCommand, endHeaderMarker="</siteinfo>"):
13021278 outputFilename = runner.dumpDir.publicPath(outputFileBasename)
13031279 chunkNum = 0
@@ -1384,9 +1360,6 @@
13851361 def listFiles(self, runner):
13861362 return [self._file()]
13871363
1388 - def matchCheckpoint(self, checkpoint):
1389 - return checkpoint == self.__class__.__name__ + "." + self._table
1390 -
13911364 class PrivateTable(PublicTable):
13921365 """Hidden table dumps for private data."""
13931366
@@ -1859,9 +1832,6 @@
18601833 else:
18611834 return [ self._file("bz2",0) ]
18621835
1863 - def matchCheckpoint(self, checkpoint):
1864 - return checkpoint == self.__class__.__name__ + "." + self._subset
1865 -
18661836 class RecombineXmlDump(XmlDump):
18671837 def __init__(self, subset, name, desc, detail, chunks = False):
18681838 # no prefetch, no spawn
@@ -1993,9 +1963,6 @@
19941964 def getCommandOutputCallback(self, line):
19951965 self._output = line
19961966
1997 - def matchCheckpoint(self, checkpoint):
1998 - return checkpoint == self.__class__.__name__ + "." + self._subset
1999 -
20001967 class RecombineXmlRecompressDump(XmlRecompressDump):
20011968 def __init__(self, subset, name, desc, detail, chunks):
20021969 XmlRecompressDump.__init__(self, subset, name, desc, detail, chunks)
@@ -2193,11 +2160,10 @@
21942161 if message:
21952162 print message
21962163 print "Usage: python worker.py [options] [wikidbname]"
2197 - print "Options: --configfile, --date, --checkpoint, --job, --force, --noprefetch, --nospawn, --restartfrom, --log"
 2164+ print "Options: --configfile, --date, --job, --force, --noprefetch, --nospawn, --restartfrom, --log"
21982165 print "--configfile: Specify an alternative configuration file to read."
21992166 print " Default config file name: wikidump.conf"
22002167 print "--date: Rerun dump of a given date (probably unwise)"
2201 - print "--checkpoint: Run just the specified step (deprecated)"
22022168 print "--job: Run just the specified step or set of steps; for the list,"
22032169 print " give the option --job help"
22042170 print " This option requires specifiying a wikidbname on which to run."
@@ -2218,7 +2184,6 @@
22192185 if __name__ == "__main__":
22202186 try:
22212187 date = None
2222 - checkpoint = None
22232188 configFile = False
22242189 forceLock = False
22252190 prefetch = True
@@ -2230,15 +2195,13 @@
22312196
22322197 try:
22332198 (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "",
2234 - ['date=', 'checkpoint=', 'job=', 'configfile=', 'force', 'noprefetch', 'nospawn', 'restartfrom', 'log'])
 2199+ ['date=', 'job=', 'configfile=', 'force', 'noprefetch', 'nospawn', 'restartfrom', 'log'])
22352200 except:
22362201 usage("Unknown option specified")
22372202
22382203 for (opt, val) in options:
22392204 if opt == "--date":
22402205 date = val
2241 - elif opt == "--checkpoint":
2242 - checkpoint = val
22432206 elif opt == "--configfile":
22442207 configFile = val
22452208 elif opt == "--force":
@@ -2279,7 +2242,7 @@
22802243 wiki = findAndLockNextWiki(config)
22812244
22822245 if wiki:
2283 - runner = Runner(wiki, date, checkpoint, prefetch, spawn, jobRequested, restart, enableLogging)
 2246+ runner = Runner(wiki, date, prefetch, spawn, jobRequested, restart, enableLogging)
22842247 if (restart):
22852248 print "Running %s, restarting from job %s..." % (wiki.dbName, jobRequested)
22862249 elif (jobRequested):

Status & tagging log