Index: branches/ariel/xmldumps-backup/worker.py |
— | — | @@ -395,7 +395,7 @@ |
396 | 396 | directory = self._getDumpRunInfoDirName() |
397 | 397 | dumpRunInfoFilename = self._getDumpRunInfoFileName() |
398 | 398 | # FileUtils.writeFile(directory, dumpRunInfoFilename, text, self.wiki.config.fileperms) |
399 | | - FileUtils.writeFileInPlace(self.wiki.config.tempDir, dumpRunInfoFilename, text, self.wiki.config.fileperms) |
| 399 | + FileUtils.writeFileInPlace(dumpRunInfoFilename, text, self.wiki.config.fileperms) |
400 | 400 | |
401 | 401 | # format: name:%; updated:%; status:% |
402 | 402 | def _getStatusForJobFromRunInfoFileLine(self, line, jobName): |
— | — | @@ -973,6 +973,29 @@ |
974 | 974 | """Constructor. Arguments: the full file name including the chunk, the extension, etc BUT NOT the dir name. """ |
975 | 975 | self.filename = filename |
976 | 976 | |
| 977 | + self.dbName = None |
| 978 | + self.date = None |
| 979 | + self.dumpName = None |
| 980 | + |
| 981 | + self.basename = None |
| 982 | + self.fileExt = None |
| 983 | + self.fileType = None |
| 984 | + |
| 985 | + self.filePrefix = "" |
| 986 | + self.filePrefixLength = 0 |
| 987 | + |
| 988 | + self.isChunkFile = False |
| 989 | + self.chunk = None |
| 990 | + self.chunkInt = 0 |
| 991 | + |
| 992 | + self.isCheckpointFile = False |
| 993 | + self.checkpoint = None |
| 994 | + self.firstPageID = None |
| 995 | + self.lastPageID = None |
| 996 | + |
| 997 | + self.isTempFile = False |
| 998 | + self.temp = None |
| 999 | + |
977 | 1000 | # example filenames: |
978 | 1001 | # elwikidb-20110729-all-titles-in-ns0.gz |
979 | 1002 | # elwikidb-20110729-abstract.xml |
— | — | @@ -983,32 +1006,14 @@ |
984 | 1007 | if self.filename.endswith("-tmp"): |
985 | 1008 | self.isTempFile = True |
986 | 1009 | self.temp = "-tmp" |
987 | | - else: |
988 | | - self.isTempFile = False |
989 | | - self.temp = None |
990 | 1010 | |
991 | 1011 | if ('.' in self.filename): |
992 | 1012 | (fileBase, self.fileExt) = self.filename.rsplit('.',1) |
993 | 1013 | if (self.temp): |
994 | 1014 | self.fileExt = self.fileExt[:-4]; |
995 | 1015 | else: |
996 | | - self.dbName = None |
997 | | - self.date = None |
998 | | - self.dumpName = None |
999 | | - self.filePrefix = "" |
1000 | | - self.filePrefixLength = 0 |
1001 | | - self.isChunkFile = False |
1002 | | - self.isCheckpointFile = False |
1003 | | - self.checkpoint = None |
1004 | | - self.firstPageID = None |
1005 | | - self.lastPageID = None |
1006 | | - self.isTempFile = False |
1007 | | - self.fileExt = None |
1008 | | - self.fileType = None |
1009 | 1016 | return False |
1010 | 1017 | |
1011 | | - # FIXME could have -tmp at the end, when do we look for that?? |
1012 | | - |
1013 | 1018 | if not self.isExt(self.fileExt): |
1014 | 1019 | self.fileType = self.fileExt |
1015 | 1020 | # self.fileExt = None |
— | — | @@ -1019,35 +1024,17 @@ |
1020 | 1025 | |
1021 | 1026 | # some files are not of this form, we skip them |
1022 | 1027 | if not '-' in fileBase: |
1023 | | - self.dbName = None |
1024 | | - self.date = None |
1025 | | - self.dumpName = None |
1026 | | - self.filePrefix = "" |
1027 | | - self.filePrefixLength = 0 |
1028 | | - self.isChunkFile = False |
1029 | | - self.isCheckpointFile = False |
1030 | | - self.checkpoint = None |
1031 | | - self.firstPageID = None |
1032 | | - self.lastPageID = None |
1033 | | - self.isTempFile = False |
1034 | | - self.temp = None |
1035 | 1028 | return False |
1036 | 1029 | |
1037 | 1030 | (self.dbName, self.date, self.dumpName) = fileBase.split('-',2) |
1038 | 1031 | if not self.date or not self.dumpName: |
1039 | | - self.dbName = None |
1040 | | - self.date = None |
1041 | 1032 | self.dumpName = fileBase |
1042 | | - self.filePrefix = "" |
1043 | | - self.filePrefixLength = 0 |
1044 | 1033 | else: |
1045 | 1034 | self.filePrefix = "%s-%s-" % (self.dbName, self.date) |
1046 | 1035 | self.filePrefixLength = len(self.filePrefix) |
1047 | 1036 | |
1048 | 1037 | if self.filename.startswith(self.filePrefix): |
1049 | 1038 | self.basename = self.filename[self.filePrefixLength:] |
1050 | | - else: |
1051 | | - self.basename = None |
1052 | 1039 | |
1053 | 1040 | self.checkpointPattern = "-p(?P<first>[0-9]+)p(?P<last>[0-9]+)\." + self.fileExt + "$" |
1054 | 1041 | self.compiledCheckpointPattern = re.compile(self.checkpointPattern) |
— | — | @@ -1060,11 +1047,6 @@ |
1061 | 1048 | self.checkpoint = "p" + self.firstPageID + "p" + self.lastPageID |
1062 | 1049 | if self.fileType and self.fileType.endswith("-" + self.checkpoint): |
1063 | 1050 | self.fileType = self.fileType[:-1 * ( len(self.checkpoint) + 1 ) ] |
1064 | | - else: |
1065 | | - self.isCheckpointFile = False |
1066 | | - self.checkpoint = None |
1067 | | - self.firstPageID = None |
1068 | | - self.lastPageID = None |
1069 | 1051 | |
1070 | 1052 | self.chunkPattern = "(?P<chunk>[0-9]+)$" |
1071 | 1053 | self.compiledChunkPattern = re.compile(self.chunkPattern) |
— | — | @@ -1075,10 +1057,6 @@ |
1076 | 1058 | self.chunkInt = int(self.chunk) |
1077 | 1059 | # the dumpName has the chunk in it so lose it |
1078 | 1060 | self.dumpName = self.dumpName.rstrip('0123456789') |
1079 | | - else: |
1080 | | - self.isChunkFile = False |
1081 | | - self.chunk = None |
1082 | | - self.chunkInt = 0 |
1083 | 1061 | |
1084 | 1062 | return True |
1085 | 1063 | |