Example #1
0
    if not writeContext is None:
        writeContext.setAndWriteConfigAfterSuccess()

        usedOAIParameters = ""
        if not appContext.getResultCollector().getHarvestingParameter(
        ) is None:
            usedOAIParameters = '\n'.join([
                '%s:: %s' % (key, value) for (key, value) in appContext.
                getResultCollector().getHarvestingParameter().items()
            ])

            procMess = [
                "start time: ",
                str(startTime), "used OAI Parameters: ", usedOAIParameters,
                "end time: " + str(datetime.now()), "outputfile: " +
                appContext.getConfiguration().getSummaryContentFile(),
                "logged skipped records (if true): " +
                appContext.getConfiguration().getSummaryContentFileSkipped(),
                "records deleted: " +
                str(appContext.getResultCollector().getRecordsDeleted()),
                "records skipped " +
                str(appContext.getResultCollector().getRecordsSkipped()),
                "records parse error: " +
                str(appContext.getResultCollector().getRecordsparseError()),
                "records to cbs inserted: " +
                str(appContext.getResultCollector().getRecordsToCBSInserted()),
                "records to cbs updated: " +
                str(appContext.getResultCollector().getRecordsToCBSUpdated()),
                "records to cbs (without skip mechanism - configuration!): " +
                str(appContext.getResultCollector().getRecordsToCBSNoSkip()),
                "\n"
Example #2
0
    except Exception as pythonBaseException:
        _writeErrorMessages(writeContext,pythonBaseException,"Exception")


    else:

        if not writeContext is None:
            writeContext.setAndWriteConfigAfterSuccess()


            usedOAIParameters = ""
            if not  appContext.getResultCollector() is None:
                if appContext.getResultCollector().getRecordsDeleted() > 0:
                    procMess = ["start time: ",  str( startTime) ,
                                "end time: " + str(datetime.now()),
                                "outputfile: " + appContext.getConfiguration().getSummaryContentFile(),
                                "records deleted and shipped to CBS: " + str(appContext.getResultCollector().getRecordsDeleted()),
                                "\n"]

                    writeContext.writeLog(header="records deleted we haven't got via the standard OAI channel",message=procMess )
                else:
                    procMess = ["\n",
                                "start time: ",  str( startTime) ,
                                "end time: " + str(datetime.now()),
                                "\n"]

                    writeContext.writeLog(header="We haven't got a compilation of deleted records that should be shipped to CBS",message=procMess )

            else:
                writeContext.writeErrorLog(message= "ResultCollector was None - Why?")
                writeContext.writeLog(message= "ResultCollector was None - Why?")
Example #3
0
        client = globals()[sConfigs.getFileProcessorType()](appContext)

        client.initialize()
        client.lookUpContent()

        client.preProcessContent()
        client.process()
        client.postProcessContent()


    except Exception as exception:

        if  not appContext is None and  not appContext.getWriteContext() is None:
            procMess=["Exception in FileProcessorImpl.py"]

            if not appContext.getConfiguration() is None:
                procMess = SwissbibUtilities.addBlockedMessageToLogSummary(procMess,appContext.getConfiguration())

            appContext.getWriteContext().handleOperationAfterError(exType=exception,
                                                        message="\n".join(procMess) )
        elif not appContext is None and  not appContext.getConfiguration() is None:

            logfile = open(appContext.getConfiguration().getErrorLogDir() + os.sep + appContext.getConfiguration().getErrorLogFile(),"a")
            message = ["no WriteContext after Error: Exception Handler",
                       str(exception)]
            message = SwissbibUtilities.addBlockedMessageToLogSummary(message,appContext.getConfiguration())
            logfile.write("\n".join(message))
            logfile.flush()
            logfile.close()
        else:
Example #4
0
    except Exception as pythonBaseException:
        _writeErrorMessages(writeContext,pythonBaseException,"Exception")


    else:

        if not writeContext is None:
            writeContext.setAndWriteConfigAfterSuccess(setTimeStamp=False)


            usedOAIParameters = ""
            if not  appContext.getResultCollector() is None:
                if appContext.getResultCollector().getRecordsDeleted() > 0:
                    procMess = ["start time: ",  str( startTime) ,
                                "end time: " + str(datetime.now()),
                                "outputfile: " + appContext.getConfiguration().getSummaryContentFile(),
                                "records deleted and shipped to CBS: " + str(appContext.getResultCollector().getRecordsDeleted()),
                                "\n"]

                    writeContext.writeLog(header="records deleted we haven't got via the standard OAI channel",message=procMess )
                else:
                    procMess = ["\n",
                                "start time: ",  str( startTime) ,
                                "end time: " + str(datetime.now()),
                                "\n"]

                    writeContext.writeLog(header="We haven't got a compilation of deleted records that should be shipped to CBS",message=procMess )

            else:
                writeContext.writeErrorLog(message= "ResultCollector was None - Why?")
                writeContext.writeLog(message= "ResultCollector was None - Why?")