oParser.add_argument("-t", "--timestamp", dest="userDatestamp", default=None) oParser.add_argument("-r", "--readTimestamps", dest="queriedTimeStamps", default=None) oParser.add_argument("-d", "--docRecordField", dest="docRecordField", default=None ) oParser.add_argument("-p", "--purgeDeleted", dest="purgeDeleted", default=False ) args = oParser.parse_args() sConfigs = HarvestingReadConfigs(args.confFile) sConfigs.setApplicationDir(os.getcwd()) appContext = ApplicationContext() appContext.setConfiguration(sConfigs) readWrapper = MongoDBHarvestingWrapperAdmin(appContext) if not args.queriedTimeStamps is None: outDir = args.outDir if not args.outDir is None else "/var/swissbib/mongo/exportlocaldbs" #we expect something like this #--readTimeStamps=2016-02-01T22:03:17Z###2016-02-02T22:03:17Z searchedTimestamps = args.queriedTimeStamps countToRead = 100000 if args.countToRead == None else args.countToRead if searchedTimestamps.find('###') != -1: dateParts = searchedTimestamps.split("###") #start and end is available readWrapper.readRecordsWithTimeStamp(startDate=dateParts[0],endDate=dateParts[1], outDir=outDir, fileSize=args.fileSize, countToRead=countToRead) elif searchedTimestamps.find('#') != -1:
try: oParser = ArgumentParser() oParser.add_argument("-c", "--config", dest="confFile") oParser.add_argument("-s", "--size", dest="fileSize") oParser.add_argument("-o", "--outDir", dest="outDir") args = oParser.parse_args() sConfigs = HarvestingReadConfigs(args.confFile) sConfigs.setApplicationDir(os.getcwd()) appContext = ApplicationContext() appContext.setConfiguration(sConfigs) backupWrapper = MongoDBHarvestingWrapperAdmin(appContext) backupWrapper.writeBackupRecords(fileSize=args.fileSize, outDir=args.outDir) backupWrapper.closeResources() except Exception as pythonBaseException: print str(pythonBaseException) finally: print "writeBackupRecords has finshed - look for possible errors"
try: oParser = ArgumentParser() oParser.add_argument("-c", "--config", dest="confFile") oParser.add_argument("-o", "--outDir", dest="outDir") args = oParser.parse_args() sConfigs = HarvestingReadConfigs(args.confFile) sConfigs.setApplicationDir(os.getcwd()) appContext = ApplicationContext() appContext.setConfiguration(sConfigs) backupWrapper = MongoDBHarvestingWrapperAdmin(appContext) backupWrapper.restoreBackupRecords( outDir=args.outDir) backupWrapper.closeResources() except Exception as pythonBaseException: print str(pythonBaseException) finally: print "process finished"
oParser = None args = None sConfigs = None cwd = None mongoWrapper = None try: oParser = ArgumentParser() oParser.add_argument("-c", "--config", dest="confFile") oParser.add_argument("-o", "--outDir", dest="outDir") args = oParser.parse_args() sConfigs = HarvestingReadConfigs(args.confFile) sConfigs.setApplicationDir(os.getcwd()) appContext = ApplicationContext() appContext.setConfiguration(sConfigs) backupWrapper = MongoDBHarvestingWrapperAdmin(appContext) backupWrapper.restoreBackupRecords(outDir=args.outDir) backupWrapper.closeResources() except Exception as pythonBaseException: print str(pythonBaseException) finally: print "process finished"
dest="docRecordField", default=None) oParser.add_argument("-p", "--purgeDeleted", dest="purgeDeleted", default=False) args = oParser.parse_args() sConfigs = HarvestingReadConfigs(args.confFile) sConfigs.setApplicationDir(os.getcwd()) appContext = ApplicationContext() appContext.setConfiguration(sConfigs) readWrapper = MongoDBHarvestingWrapperAdmin(appContext) if not args.queriedTimeStamps is None: outDir = args.outDir if not args.outDir is None else "/var/swissbib/mongo/exportlocaldbs" #we expect something like this #--readTimeStamps=2016-02-01T22:03:17Z###2016-02-02T22:03:17Z searchedTimestamps = args.queriedTimeStamps countToRead = 100000 if args.countToRead == None else args.countToRead if searchedTimestamps.find('###') != -1: dateParts = searchedTimestamps.split("###") #start and end is available readWrapper.readRecordsWithTimeStamp(startDate=dateParts[0], endDate=dateParts[1], outDir=outDir, fileSize=args.fileSize,