internal crawlerErrorLog CreateAndSaveError(Exception ex, modelSpiderSiteRecord wRecord, crawlerDomainTask crawlerDomainTask, crawlerErrorEnum errorType) { crawlerErrorLog clog = crawlerErrorLog.CreateAndSave(ex, wRecord, crawlerDomainTask, errorType); clog.SaveXML(folder[DRFolderEnum.logs].pathFor("DLC_crash_" + wRecord.domainInfo.domainRootName.getFilename())); return(clog); }
public override void eventUniversal <TTask, TBase>(crawlJobEngineStageEnum stage, crawlerDomainTaskMachine __machine, TTask __task, TBase __spider) { if (!IsEnabled) { return; } if (plugins[stage].Any(x => x.IsEnabled)) { crawlerDomainTask tsk = __task as crawlerDomainTask; foreach (IPlugInCommonBase <crawlJobEngineStageEnum, crawlerDomainTaskMachine> plug in plugins[stage]) { try { plug.eventUniversal(stage, __machine, __task, __spider); //if (plug is ISpiderPlugInForContent) ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } catch (Exception ex) { aceLog.log("Engine Plugin [" + plug.name + "]:" + plug.GetType().Name + " at " + stage.ToString() + " execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, tsk, crawlerErrorEnum.enginePlugin); cel.SaveXML(); } } } }
public override void eventUniversal <indexDomain, indexPage>(indexMaintenanceStageEnum stage, experimentSessionEntry __parent, indexDomain __resource, indexPage __resourceSecond) { if (!IsEnabled) { return; } if (plugins[stage].Any(x => x.IsEnabled)) { foreach (IPlugInCommonBase <indexMaintenanceStageEnum, experimentSessionEntry> plug in plugins[stage]) { try { plug.eventUniversal(stage, __parent, __resource, __resourceSecond); //if (plug is ISpiderPlugInForContent) ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } catch (Exception ex) { aceLog.log("Index Plugin [" + plug.name + "]:" + plug.GetType().Name + " at " + stage.ToString() + " execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, null, crawlerErrorEnum.indexPlugin); cel.SaveXML(); } } } }
public void eventCrawlJobFinished(crawlerDomainTaskMachine __machine, modelSpiderTestRecord __tRecord) // <---- ovaj se nikad ne poziva { foreach (reportPlugIn_base plug in allPlugins) { try { plug.eventCrawlJobFinished(__machine, __tRecord); } catch (Exception ex) { aceLog.log("Reporting Plugin [" + plug.name + "]:" + plug.GetType().Name + " at status report execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, null, crawlerErrorEnum.indexPlugin); cel.SaveXML(); } } }
public void eventIteration(ISpiderEvaluatorBase __spider, crawlerDomainTask __task, modelSpiderSiteRecord __wRecord) { if (!IsEnabled) { return; } foreach (reportPlugIn_base plug in allPlugins) { try { plug.eventIteration(__spider, __task, __wRecord); } catch (Exception ex) { aceLog.log("Reporting Plugin [" + plug.name + "]:" + plug.GetType().Name + " at status report execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, null, crawlerErrorEnum.indexPlugin); cel.SaveXML(); } } }
public void eventAtEndOfCrawlJob(crawlerDomainTaskMachine crawlerDomainTaskMachine, modelSpiderTestRecord tRecord) { if (!IsEnabled) { return; } foreach (reportPlugIn_base plug in allPlugins) { try { plug.eventAtEndOfCrawlJob(crawlerDomainTaskMachine, tRecord); //if (plug is ISpiderPlugInForContent) ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } catch (Exception ex) { aceLog.log("Reporting Plugin [" + plug.name + "]:" + plug.GetType().Name + " at status report execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, null, crawlerErrorEnum.indexPlugin); cel.SaveXML(); } } }
public void eventUniversal(crawlReportingStageEnum stage, directReporterBase __parent, crawlerDomainTask __task, modelSpiderSiteRecord wRecord) { //if (!IsEnabled) return; if (plugins[stage].Any(x => x.IsEnabled)) { foreach (reportPlugIn_base plug in allPlugins) { try { switch (stage) { case crawlReportingStageEnum.domain: plug.eventDLCFinished(__parent, __task, wRecord); break; case crawlReportingStageEnum.init: plug.eventDLCInitiated(__parent, __task, wRecord); break; default: plug.eventUniversal(stage, __parent, __task, wRecord); break; } //if (plug is ISpiderPlugInForContent) ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } catch (Exception ex) { aceLog.log("Reporting Plugin [" + plug.name + "]:" + plug.GetType().Name + " at " + stage.ToString() + " execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, null, null, crawlerErrorEnum.indexPlugin); cel.SaveXML(); } } } else { } }
/// <summary> /// Processes the universal call. /// </summary> /// <param name="phase">The phase.</param> /// <param name="wRecord">The w record.</param> /// <param name="wTask">The w task.</param> /// <param name="sResult">The s result.</param> /// <param name="tRecord">The t record.</param> /// <param name="dataUnit">The data unit.</param> protected void processUniversalCall(crawlerDomainTaskIterationPhase phase, modelSpiderSiteRecord wRecord, crawlerDomainTask wTask, spiderTaskResult sResult = null, modelSpiderTestRecord tRecord = null, dataUnitSpiderIteration dataUnit = null) { if (!IsEnabled) { return; } if (plugins[phase].Any(x => x.IsEnabled)) { foreach (ISpiderPlugIn plug in plugins[phase]) { try { switch (phase) { case crawlerDomainTaskIterationPhase.applyLinkRules: if (plug is ISpiderPlugInForContent) { ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } break; case crawlerDomainTaskIterationPhase.checkingRules: break; case crawlerDomainTaskIterationPhase.getLoadTask: if (plug is ISpiderPlugInForContentPostprocess) { ((ISpiderPlugInForContentPostprocess)plug).processEndOfIteration(wRecord, wTask); } break; case crawlerDomainTaskIterationPhase.iterationProcessFinished: break; case crawlerDomainTaskIterationPhase.iterationProcessInit: break; case crawlerDomainTaskIterationPhase.iterationProcessNotStarted: break; case crawlerDomainTaskIterationPhase.iterationStart: break; case crawlerDomainTaskIterationPhase.loadingSeedPage: break; case crawlerDomainTaskIterationPhase.loadingTask: break; case crawlerDomainTaskIterationPhase.none: break; case crawlerDomainTaskIterationPhase.pageEvaluation: if (plug is ISpiderPlugInForContentPostprocess) { ((ISpiderPlugInForContentPostprocess)plug).processAtDLCFinished(wRecord, wTask); } break; case crawlerDomainTaskIterationPhase.receiveResult: if (plug is ISpiderPlugInForContent) { ((ISpiderPlugInForContent)plug).processLoaderResult(sResult, wRecord, wTask); } break; case crawlerDomainTaskIterationPhase.updatingData: break; } //if (plug is ISpiderPlugInForContent) ((ISpiderPlugInForContent)plug).processAfterResultReceived(wRecord, wTask); } catch (Exception ex) { aceLog.log("Index Plugin [" + plug.name + "]:" + plug.GetType().Name + " at " + phase.ToString() + " execution crashed: " + ex.Message); crawlerErrorLog cel = new crawlerErrorLog(ex, wRecord, wTask, crawlerErrorEnum.crawlerPlugin); cel.SaveXML(); } } } }