Пример #1
0
 private void WaitForAllExportsToComplete()
 {
     BenchmarkLogging.Info("Waiting for final export jobs to complete.");
     while (_activeJobList.Count > 0)
     {
         var toRemove = new List <string>();
         foreach (var jobId in _activeJobList)
         {
             var jobInfo = _brightstar.GetJobInfo(_storeName, jobId);
             if (jobInfo.JobCompletedWithErrors)
             {
                 BenchmarkLogging.Error("Export {0} failed. Cause: {1}. Detail {2}", jobInfo.Label,
                                        jobInfo.StatusMessage, jobInfo.ExceptionInfo);
                 toRemove.Add(jobId);
             }
             if (jobInfo.JobCompletedOk)
             {
                 ReportCompletedJob(jobInfo);
                 toRemove.Add(jobId);
             }
         }
         foreach (var r in toRemove)
         {
             _activeJobList.Remove(r);
         }
         Thread.Sleep(5000);
     }
 }
Пример #2
0
 public BenchmarkRunner(BenchmarkArgs args)
 {
     SourceFiles = Directory.GetFiles(args.TestDataDirectory, "*.nt", SearchOption.AllDirectories);
     BenchmarkLogging.Info("Found {0} source NTriples files for benchmark test", SourceFiles.Length);
     if (args.MaxNumberFiles > 0 && args.MaxNumberFiles < SourceFiles.Length)
     {
         SourceFiles = SourceFiles.Take(args.MaxNumberFiles).ToArray();
         BenchmarkLogging.Info("Limited number of source files to be processed to {0} (from command-line options)", SourceFiles.Length);
     }
     _brightstar = new EmbeddedBrightstarService(".");
     _storeName  = "BenchmarkStore_" + DateTime.Now.ToString("yyMMdd_HHmmss");
 }
Пример #3
0
        private void ImportSourceFile(int sourceFileIndex)
        {
            var fullText  = File.ReadAllText(SourceFiles[sourceFileIndex]);
            var lineCount = CountLines(SourceFiles[sourceFileIndex]);
            var sw        = Stopwatch.StartNew();

            _brightstar.ExecuteTransaction(_storeName, new UpdateTransactionData {
                InsertData = fullText
            });
            var importTime = sw.ElapsedMilliseconds;

            BenchmarkLogging.Info("IMPORT: {0},{1},{2}", _triplesImported, _triplesImported + lineCount, importTime);
            _triplesImported += lineCount;
        }
Пример #4
0
        private void ReportCompletedJob(IJobInfo jobInfo)
        {
            var expectedCount = Int32.Parse(jobInfo.Label.Split('_').Last());

            BenchmarkLogging.Info("EXPORT {0}, {1}", expectedCount, jobInfo.EndTime.Subtract(jobInfo.StartTime).TotalMilliseconds);
            var actualCount = CountLines("import" + Path.DirectorySeparatorChar + jobInfo.Label + ".nt");

            if (expectedCount == actualCount)
            {
                BenchmarkLogging.Info("Validated expected number of triples exported in {0}.nt", jobInfo.Label);
            }
            else
            {
                BenchmarkLogging.Error("Exported triple count in file {0}.nt does not match the expected count. (Expected: {1}, Counted: {2})",
                                       jobInfo.Label, expectedCount, actualCount);
            }
        }