Index: trunk/backup/worker.py |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | |
59 | 59 | class Runner(object): |
60 | 60 | |
61 | | - def __init__(self, wiki, date=None, checkpoint=None, prefetch=True): |
| 61 | + def __init__(self, wiki, date=None, checkpoint=None, prefetch=True, spawn=True): |
62 | 62 | self.wiki = wiki |
63 | 63 | self.config = wiki.config |
64 | 64 | self.dbName = wiki.dbName |
— | — | @@ -248,10 +248,10 @@ |
249 | 249 | XmlStub("First-pass for page XML data dumps"), |
250 | 250 | XmlDump("articles", |
251 | 251 | "<big><b>Articles, templates, image descriptions, and primary meta-pages.</b></big>", |
252 | | - "This contains current versions of article content, and is the archive most mirror sites will probably want.", prefetch), |
| 252 | + "This contains current versions of article content, and is the archive most mirror sites will probably want.", prefetch, spawn), |
253 | 253 | XmlDump("meta-current", |
254 | 254 | "All pages, current versions only.", |
255 | | - "Discussion and user pages are included in this complete archive. Most mirrors won't want this extra material.", prefetch), |
| 255 | + "Discussion and user pages are included in this complete archive. Most mirrors won't want this extra material.", prefetch, spawn), |
256 | 256 | XmlLogging("Pull out all logging data")] |
257 | 257 | if self.wiki.hasFlaggedRevs(): |
258 | 258 | self.items.append( |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | BigXmlDump("meta-history", |
265 | 265 | "All pages with complete page edit history (.bz2)", |
266 | 266 | "These dumps can be *very* large, uncompressing up to 20 times the archive download size. " + |
267 | | - "Suitable for archival and statistical use, most mirror sites won't want or need this.", prefetch)) |
| 267 | + "Suitable for archival and statistical use, most mirror sites won't want or need this.", prefetch, spawn)) |
268 | 268 | self.items.append( |
269 | 269 | XmlRecompressDump("meta-history", |
270 | 270 | "All pages with complete edit history (.7z)", |
— | — | @@ -724,11 +724,12 @@ |
725 | 725 | |
726 | 726 | class XmlDump(Dump): |
727 | 727 | """Primary XML dumps, one section at a time.""" |
728 | | - def __init__(self, subset, desc, detail, prefetch): |
| 728 | + def __init__(self, subset, desc, detail, prefetch, spawn): |
729 | 729 | Dump.__init__(self, desc) |
730 | 730 | self._subset = subset |
731 | 731 | self._detail = detail |
732 | 732 | self._prefetch = prefetch |
| 733 | + self._spawn = spawn |
733 | 734 | |
734 | 735 | def detail(self): |
735 | 736 | """Optionally return additional text to appear under the heading.""" |
— | — | @@ -779,7 +780,12 @@ |
780 | 781 | else: |
781 | 782 | runner.status("... building %s XML dump, no text prefetch..." % self._subset) |
782 | 783 | prefetch = None |
783 | | - |
| 784 | + |
| 785 | + if self._spawn: |
| 786 | + spawn = "--spawn=%s" % (runner.config.php) |
| 787 | + else: |
| 788 | + spawn = None |
| 789 | + |
784 | 790 | dumpCommand = """ |
785 | 791 | %s -q %s/maintenance/dumpTextPass.php \ |
786 | 792 | --wiki=%s \ |
— | — | @@ -788,7 +794,7 @@ |
789 | 795 | %s \ |
790 | 796 | --report=1000 \ |
791 | 797 | --server=%s \ |
792 | | - --spawn=%s""" % shellEscape(( |
| 798 | + %s""" % shellEscape(( |
793 | 799 | runner.config.php, |
794 | 800 | runner.config.wikiDir, |
795 | 801 | runner.dbName, |
— | — | @@ -796,7 +802,7 @@ |
797 | 803 | prefetch, |
798 | 804 | runner.forceNormalOption(), |
799 | 805 | runner.dbServer, |
800 | | - runner.config.php)) |
| 806 | + spawn)) |
801 | 807 | command = dumpCommand |
802 | 808 | return command |
803 | 809 | |
— | — | @@ -975,9 +981,10 @@ |
976 | 982 | checkpoint = None |
977 | 983 | forceLock = False |
978 | 984 | prefetch = True |
| 985 | + spawn = True |
979 | 986 | |
980 | 987 | (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "", |
981 | | - ['date=', 'checkpoint=', 'force', 'noprefetch']) |
| 988 | + ['date=', 'checkpoint=', 'force', 'noprefetch', 'nospawn']) |
982 | 989 | for (opt, val) in options: |
983 | 990 | if opt == "--date": |
984 | 991 | date = val |
— | — | @@ -987,6 +994,8 @@ |
988 | 995 | forceLock = True |
989 | 996 | elif opt == "--noprefetch": |
990 | 997 | prefetch = False |
| 998 | + elif opt == "--nospawn": |
| 999 | + spawn = False |
991 | 1000 | |
992 | 1001 | if len(remainder) > 0: |
993 | 1002 | wiki = WikiDump.Wiki(config, remainder[0]) |
— | — | @@ -998,7 +1007,7 @@ |
999 | 1008 | wiki = findAndLockNextWiki(config) |
1000 | 1009 | |
1001 | 1010 | if wiki: |
1002 | | - runner = Runner(wiki, date, checkpoint, prefetch) |
| 1011 | + runner = Runner(wiki, date, checkpoint, prefetch, spawn) |
1003 | 1012 | print "Running %s..." % wiki.dbName |
1004 | 1013 | runner.run() |
1005 | 1014 | wiki.unlock() |