Index: branches/ariel/xmldumps-backup/worker.py |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | # everything that has to do with reporting the status of a piece |
700 | 700 | # of a dump is collected here |
701 | 701 | class Status(object): |
702 | | - def __init__(self, wiki, dumpDir, date, items, checksums, errorCallback=None): |
| 702 | + def __init__(self, wiki, dumpDir, date, items, checksums, notice="", errorCallback=None): |
703 | 703 | self.wiki = wiki |
704 | 704 | self.config = wiki.config |
705 | 705 | self.dbName = wiki.dbName |
— | — | @@ -707,6 +707,7 @@ |
708 | 708 | self.checksums = checksums |
709 | 709 | self.date = date |
710 | 710 | # this is just a glorified name for "give me a logging facility" |
| 711 | + self.htmlNotice = notice |
711 | 712 | self.errorCallback = errorCallback |
712 | 713 | self.failCount = 0 |
713 | 714 | |
— | — | @@ -740,6 +741,7 @@ |
741 | 742 | else: |
742 | 743 | return html |
743 | 744 | |
| 745 | + # FIXME add capacity for special notice here. |
744 | 746 | def reportDatabaseStatusDetailed(self, done=False): |
745 | 747 | """Put together a status page for this database, with all its component dumps.""" |
746 | 748 | statusItems = [self.reportItem(item) for item in self.items] |
— | — | @@ -748,6 +750,7 @@ |
749 | 751 | return self.config.readTemplate("report.html") % { |
750 | 752 | "db": self.dbName, |
751 | 753 | "date": self.date, |
| 754 | + "notice": self.htmlNotice, |
752 | 755 | "status": self.reportStatusSummaryLine(done), |
753 | 756 | "previous": self.reportPreviousDump(done), |
754 | 757 | "items": html, |
— | — | @@ -842,7 +845,7 @@ |
843 | 846 | |
844 | 847 | class Runner(object): |
845 | 848 | |
846 | | - def __init__(self, wiki, date=None, prefetch=True, spawn=True, job=None, restart=False, loggingEnabled=False): |
| 849 | + def __init__(self, wiki, date=None, prefetch=True, spawn=True, job=None, restart=False, notice="", loggingEnabled=False): |
847 | 850 | self.wiki = wiki |
848 | 851 | self.config = wiki.config |
849 | 852 | self.dbName = wiki.dbName |
— | — | @@ -851,6 +854,7 @@ |
852 | 855 | self.chunkInfo = Chunk(wiki, self.dbName, self.logAndPrint) |
853 | 856 | self.restart = restart |
854 | 857 | self.loggingEnabled = loggingEnabled |
| 858 | + self.htmlNotice = notice |
855 | 859 | self.log = None |
856 | 860 | |
857 | 861 | if date: |
— | — | @@ -880,7 +884,7 @@ |
881 | 885 | # some or all of these dumpItems will be marked to run |
882 | 886 | self.dumpItemList = DumpItemList(self.wiki, self.prefetch, self.spawn, self.date, self.chunkInfo); |
883 | 887 | |
884 | | - self.status = Status(self.wiki, self.dumpDir, self.date, self.dumpItemList.dumpItems, self.checksums, self.logAndPrint) |
| 888 | + self.status = Status(self.wiki, self.dumpDir, self.date, self.dumpItemList.dumpItems, self.checksums, self.htmlNotice, self.logAndPrint) |
885 | 889 | |
886 | 890 | def logQueueReader(self,log): |
887 | 891 | if not log: |
— | — | @@ -2160,10 +2164,13 @@ |
2161 | 2165 | if message: |
2162 | 2166 | print message |
2163 | 2167 | print "Usage: python worker.py [options] [wikidbname]" |
2164 | | - print "Options: --configfile, --date, --job, --force, --noprefetch, --nospawn, --restartfrom, --log" |
| 2168 | + print "Options: --configfile, --date, --job, --notice, --force, --noprefetch, --nospawn, --restartfrom, --log" |
2165 | 2169 | print "--configfile: Specify an alternative configuration file to read." |
2166 | 2170 | print " Default config file name: wikidump.conf" |
2167 | 2171 | print "--date: Rerun dump of a given date (probably unwise)" |
| 2172 | + print "--notice: Text message that will be inserted in the per-dump-run index.html" |
| 2173 | + print " file; use this when rerunning some job and you want to notify the" |
| 2174 | + print " potential downloaders of problems, for example." |
2168 | 2175 | print "--job: Run just the specified step or set of steps; for the list," |
2169 | 2176 | print " give the option --job help" |
2170 | 2177 | print " This option requires specifiying a wikidbname on which to run." |
— | — | @@ -2192,10 +2199,11 @@ |
2193 | 2200 | jobRequested = None |
2194 | 2201 | enableLogging = False |
2195 | 2202 | log = None |
| 2203 | + htmlNotice = "" |
2196 | 2204 | |
2197 | 2205 | try: |
2198 | 2206 | (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "", |
2199 | | - ['date=', 'job=', 'configfile=', 'force', 'noprefetch', 'nospawn', 'restartfrom', 'log']) |
| 2207 | + ['date=', 'job=', 'configfile=', 'notice=', 'force', 'noprefetch', 'nospawn', 'restartfrom', 'log']) |
2200 | 2208 | except: |
2201 | 2209 | usage("Unknown option specified") |
2202 | 2210 | |
— | — | @@ -2216,6 +2224,8 @@ |
2217 | 2225 | restart = True |
2218 | 2226 | elif opt == "--log": |
2219 | 2227 | enableLogging = True |
| 2228 | + elif opt == "--notice": |
| 2229 | + htmlNotice = val |
2220 | 2230 | |
2221 | 2231 | if jobRequested and (len(remainder) == 0): |
2222 | 2232 | usage("--job option requires the name of a wikidb to be specified") |
— | — | @@ -2242,7 +2252,7 @@ |
2243 | 2253 | wiki = findAndLockNextWiki(config) |
2244 | 2254 | |
2245 | 2255 | if wiki: |
2246 | | - runner = Runner(wiki, date, prefetch, spawn, jobRequested, restart, enableLogging) |
| 2256 | + runner = Runner(wiki, date, prefetch, spawn, jobRequested, restart, htmlNotice, enableLogging) |
2247 | 2257 | if (restart): |
2248 | 2258 | print "Running %s, restarting from job %s..." % (wiki.dbName, jobRequested) |
2249 | 2259 | elif (jobRequested): |
Index: branches/ariel/xmldumps-backup/report.html |
— | — | @@ -46,6 +46,10 @@ |
47 | 47 | color: Maroon; |
48 | 48 | font-weight: bold; |
49 | 49 | } |
| 50 | + .notice { |
| 51 | + color: Maroon; |
| 52 | + font-weight: normal; |
| 53 | + } |
50 | 54 | .waiting { |
51 | 55 | color: Silver; /* Gray ? */ |
52 | 56 | } |
— | — | @@ -66,7 +70,9 @@ |
67 | 71 | See <a href="http://meta.wikimedia.org/wiki/Data_dumps">Meta:Data dumps</a> |
68 | 72 | for documentation on the provided data formats. |
69 | 73 | </p> |
70 | | - |
| 74 | + |
| 75 | + <p class="notice">%(notice)s</p> |
| 76 | + |
71 | 77 | <p>See <a href="../../%(index)s">all databases list</a>.</p> |
72 | 78 | |
73 | 79 | <p class="previous"> |