/// <summary> /// Inititializes the specified a flags. /// </summary> /// <param name="aFlags">a flags.</param> /// <param name="macroScript">The macro script.</param> public void inititialize(analyticJobRunFlags aFlags = analyticJobRunFlags.none, analyticMacroBase macroScript = null) { if (macroScript != null) { stageControl = macroScript.helpMethodBuildStageControl(aRecord, this); } // tokenCounters.connectParents(aRecord.tokenCounters); state = modelRecordStateEnum.initiated; // report.deploySample(sample); }
/// <summary> /// Initializes the specified a flags. /// </summary> /// <param name="aFlags">a flags.</param> /// <param name="macroScript">The macro script.</param> public void initialize(analyticJobRunFlags aFlags, analyticMacroBase macroScript) { log("Analytic macro script [" + GetType().Name + "] initialization started"); log("Runstamp [" + testRunStamp + "]"); logBuilder.open("tag", "Job initialization", "the system initial self-configuration"); //imbSemanticEngine.imbSemanticEngineManager.cacheManagerForContentTreeBuilder.cacheLoadDisabled = (!aFlags.HasFlag(analyticJobRunFlags.enable_WebStructureCache)); //imbSemanticEngine.imbSemanticEngineManager.cacheManagerForContentPage.cacheLoadDisabled = (!aFlags.HasFlag(analyticJobRunFlags.enable_NLPCache)); //imbSemanticEngine.imbSemanticEngineManager.cacheManagerForHtmlContentPage.cacheLoadDisabled = (!aFlags.HasFlag(analyticJobRunFlags.enable_WebCache)); checkList aFlagCheckList = new checkList(aFlags); //if (!sample.Any()) //{ // sample = sciProject.getSamples(job.sampleTags, sampleTakeLimit, testRunStamp, sampleBlockOrdinalNumber); //sciProject.mainWebProfiler.webSiteProfiles.Where<webSiteProfile>(x => x.groupTags.Contains(job.sampleGroup.groupTag)).Take(sampleTakeLimit);// wpGroups.selectGroup(wpGroups.primarySample, terminal, profiler.webSiteProfiles, runstamp, "", false); // log(sample.logMessage); //} //sample = new webSiteProfileSample(wbp, sciProject.mainWebProfiler, sciProject.mainWebProfiler.webSiteProfiles); //sample.usedGroups.Add(job.sampleGroup.groupTag); //sample.usedStamp = testRunStamp; //sample.usedSettings = sciProject.mainWebProfiler.sampler; if (!spiderList.Any()) { spiderList = macroScript.helpMethodBuildSpiders(job, sciProject); } tGeneralRecord = new modelSpiderTestGeneralRecord(testRunStamp, job); tGeneralRecord.parent = this; foreach (ISpiderEvaluatorBase evalBase in spiderList) { log("Assigning [" + evalBase.name + "] to [" + instanceID + "]"); var tRecord = children.Add(evalBase); tRecord.parent = this; tRecord.instanceID = evalBase.name; tRecord.testRunStamp = testRunStamp; // evalBase.language = imbLanguageFramework.imbLanguageFrameworkManager.serbian.basic; tRecord.inititialize(aFlags, macroScript); } // log("Sample entries selected [" + sample.Count() + "] from [" + sample.usedGroups.Join(",") + "]"); logBuilder.close(); recordStart(testRunStamp, sciProject.name); startChildRecord(spiderList.First(), spiderList.First().name); }
public analyticJobRecord(analyticJob __job, analyticProject __sciProject, analyticJobRunFlags aFlags) : base(__sciProject.name, __job) { job = __job; //sampleTakeLimit = aFlags.getSampleTakeLimit(); //if (sampleTakeLimit == 0) sampleTakeLimit = imbWEMManager.settings.sampleTakeLimit; //sampleTakeLimit = sampleTakeLimit + job.sampleSkip; //sampleTakeLimit = Math.Min(imbWEMManager.settings.sampleTakeLimit, sampleTakeLimit); sampleBlockOrdinalNumber = 0; // imbWEMManager.settings.sampleTakeBlock; sciProject = __sciProject; // contentTreeGlobalRegistar.allowExistingContentTrees = imbWEMManager.settings.loaderComponent.cacheInMemoryContentTree; //tokenizedContentGlobalRegistar.allowUseExisting = imbWEMManager.settings.loaderComponent.cacheInMemoryTokenizedContent; }
/// <summary> /// Gets the samples from web site profile collection /// </summary> /// <param name="sciProject">The science project.</param> /// <param name="sampleTags">The sample tags.</param> /// <param name="sampleTakeLimit">The sample take limit.</param> /// <param name="usedStamp">The used stamp.</param> /// <returns></returns> //public static webSiteProfileSample getSamples(this analyticProject sciProject, IEnumerable<string> sampleTags, int sampleTakeLimit, string usedStamp="", int sampleBlockOrdinalNumber=0, bool random=false) //{ // List<imbCore.data.entity.relationship.IRelatedCollectionItem> allSites = sciProject.mainWebProfiler.webSiteProfiles.selectItemsAll(); // List<webSiteProfile> allInGroup = new List<webSiteProfile>(); // foreach (webSiteProfile sp in allSites) // { // if (sp.groupTags.ContainsAny(sampleTags)) // { // allInGroup.Add(sp); // } // } // if (random) // { // allInGroup.Randomize(); // } // IEnumerable<webSiteProfile> wbp = new List<webSiteProfile>(); // int skipCount = 0; // if (sampleBlockOrdinalNumber == 0) sampleBlockOrdinalNumber = 1; // skipCount = (sampleBlockOrdinalNumber - 1) * sampleTakeLimit; // int take = 0; // if (allInGroup.Count() > skipCount) // { // wbp = allInGroup.Skip(skipCount); // take = Math.Min(wbp.Count(), sampleTakeLimit); // wbp = wbp.Take(take); // } // //var wbp = allInGroup.Skip() // // = .Take(sampleTakeLimit);// wpGroups.selectGroup(wpGroups.primarySample, terminal, profiler.webSiteProfiles, runstamp, "", false); // webSiteProfileSample sample = new webSiteProfileSample(wbp, sciProject.mainWebProfiler, sciProject.mainWebProfiler.webSiteProfiles); // sample.usedGroups.AddRange(sampleTags); // sample.usedStamp = usedStamp; // sample.usedSettings = sciProject.mainWebProfiler.sampler; // sample.logMessage = "Sample from groups [" + sampleTags.ToCSV(',') + "] block [" + sampleBlockOrdinalNumber + "] - start: " + skipCount + " - take: " + take; // return sample; //} public static int getSampleTakeLimit(this analyticJobRunFlags aFlags) { int output = 0; if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake2)) { output += 2; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake5)) { output += 5; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake10)) { output += 10; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake15)) { output += 15; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake25)) { output += 25; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake40)) { output += 40; } if (aFlags.HasFlag(analyticJobRunFlags.sample_devTake100)) { output += 100; } return(output); }
/// <summary> /// Override this method with the <see cref="analyticMacroBase"/> execution code. /// </summary> /// <remarks> /// <para>It is called after initiation part from <see cref="run(analyticJob, analyticJobRunFlags, analyticProject, builderForLog)"/></para> /// <para>This method would never be called it <see cref="analyticJobRunFlags.execution_skipTest"/> is inside <see cref="aFlags"/></para> /// </remarks> /// <param name="aJob">a job.</param> /// <param name="aFlags">a flags.</param> /// <param name="aProject">a project.</param> /// <param name="aTerminal">a terminal.</param> /// <returns></returns> protected abstract bool innerRun(analyticJob aJob, analyticJobRunFlags aFlags, analyticProject aProject, analyticJobRecord aRecord);
/// <summary> /// Runs the macro. To adjust macro execution override <see cref="innerRun(analyticJob, analyticJobRunFlags, analyticProject, builderForLog)"/> method. /// <c>innerRun</c> is called witnih this method, after common initalization procedure /// </summary> /// <remarks> /// <para>Report creation is done after <see cref="innerRun(analyticJob, analyticJobRunFlags, analyticProject, builderForLog)"/> call.</para> /// </remarks> /// <param name="aJob">a job.</param> /// <param name="aFlags">a flags.</param> /// <param name="aProject">a project.</param> /// <param name="aTerminal">a terminal.</param> /// <returns></returns> public deliveryInstance run(analyticJob aJob, analyticJobRunFlags aFlags, analyticProject aProject = null, builderForLog aTerminal = null) { string runstamp = aJob.runstamp; //aFlags = aFlags.SetFlag<analyticJobRunFlags>(analyticJobRunFlags.report_FolderPurge, imbWEMManager.settings.postReportEngine.reportPurgeFolder); //bool projectCreated = false; //if ((aProject == null) || aFlags.HasFlag(analyticJobRunFlags.setup_sciProjectFromPreset)) //{ // //aProject = new analyticProject(); // //aProject.afterLoadDeploy(); // //projectCreated = true; //} //analyticJobRecord aRecord = new analyticJobRecord(aJob, aProject, aFlags); //aceLog.consoleControl.setAsOutput(aRecord, "aRecord"); //// <---------- counting the sample //imbWEMManager.webProfileGroups.setGroupCounts(aProject.mainWebProfiler.webSiteProfiles); //if (projectCreated) aRecord.logBuilder.log("SciProject new instance (byFlag) ::" + aProject.GetType().Name + " with defaults"); // Analytic macro script [" + this.GetType().Name + "] execution started"); //if (aTerminal != null) //{ // //aceLog.logBuilderRegistry.Add(logOutputSpecial.systemMainLog, aTerminal); // logSystem.externalLoger = aTerminal; //} //// ---------------------------------------------------------------- INITIATION SECTION ////----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //if (!aFlags.HasFlag(analyticJobRunFlags.execution_skipTest)) //{ // aRecord.logBuilder.open("tag", "Execution: " + GetType().Name, "the system initial self-configuration"); // ////// ---------------------------------------------------- INNER RUN CALL // innerRun(aJob, aFlags, aProject, aRecord); // ////// ---------------------------------------------------- INNER RUN CALL // aRecord.logBuilder.close(); // ///// inner run called //} else //{ // aRecord.logBuilder.log("The macro script never executed :: " + analyticJobRunFlags.execution_skipTest + " default instance created"); //} //// <---------- Record is finished //aRecord.recordFinish(); //// ---------------------------------------------------------------- REPORTING SECTION //aRecord.logBuilder.log("Report construction initiated"); //// -- create deliveryInstance //executeOtherCommons(aRecord); //metaDocumentRootSet aReport = executeBuildReport(aRecord); // deliveryInstance reportDeliveryInstance = executeRenderReport(aReport, aRecord); return(null); // reportDeliveryInstance; }