Esempio n. 1
0
    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"





            if dateParts[0].lower() == "start":
                readWrapper.readRecordsWithTimeStamp(startDate=dateParts[1], endDate=None,
                                                     outDir=outDir, fileSize=args.fileSize,
                                                     countToRead=countToRead)
            elif dateParts[0].lower() == "end":
                readWrapper.readRecordsWithTimeStamp(startDate=None, endDate=dateParts[1],
                                                     outDir=outDir, fileSize=args.fileSize,
                                                     countToRead=countToRead)
        else:
            print "no date parameters are matching as start and/or end date - nothing is done"



    else:
        readWrapper.readRecords(rId=args.idToRead,countToRead=args.countToRead,
                                    fileSize=args.fileSize, outDir=args.outDir,condition=args.condition,
                                    inputFile=args.inputFile,
                                    userDatestamp=args.userDatestamp,
                                    docRecordField=args.docRecordField,
                                    purgeDeleted=args.purgeDeleted
                                )


except Exception as pythonBaseException:
    print str(pythonBaseException)

finally:
    if not readWrapper is None:
        readWrapper.closeResources()
    #print "process readOAIRecords has finished - look for possible errors"
                                                     outDir=outDir,
                                                     fileSize=args.fileSize,
                                                     countToRead=countToRead)
            elif dateParts[0].lower() == "end":
                readWrapper.readRecordsWithTimeStamp(startDate=None,
                                                     endDate=dateParts[1],
                                                     outDir=outDir,
                                                     fileSize=args.fileSize,
                                                     countToRead=countToRead)
        else:
            print "no date parameters are matching as start and/or end date - nothing is done"

    else:
        readWrapper.readRecords(rId=args.idToRead,
                                countToRead=args.countToRead,
                                fileSize=args.fileSize,
                                outDir=args.outDir,
                                condition=args.condition,
                                inputFile=args.inputFile,
                                userDatestamp=args.userDatestamp,
                                docRecordField=args.docRecordField,
                                purgeDeleted=args.purgeDeleted)

except Exception as pythonBaseException:
    print str(pythonBaseException)

finally:
    if not readWrapper is None:
        readWrapper.closeResources()
    #print "process readOAIRecords has finished - look for possible errors"