예제 #1
0
        /// <summary>
        /// Send a request for acknoledgement of job error
        /// </summary>
        /// <param name="config">The extraction routine's configuration</param>
        /// <param name="error">Any error message to be passed</param>
        /// <returns>True if acknoledged, false otherwise</returns>
        public bool sendJobErrorRequest(ExtractorConfiguration config, ExtractorReport report)
        {
            //LOG.Debug("Sending the orchestrator a job error request");
            MessageTO message = new MessageTO()
            {
                Message = "Job Error!",
                //Extractor = new Extractor(extractor.HostName, extractor.ListeningPort,
                //    extractor.SiteCode, extractor.VistaFile, extractor.Timestamp),
                Configuration   = config,
                ExtractorReport = report,
                //Error = report.ToString(),
                //HostName = extractor.HostName,
                //ListeningPort = extractor.ListeningPort,
                MessageType = MessageTypeTO.JobErrorRequest
            };
            MessageTO response = submitRequest(message);

            if (response == null || response.MessageType != MessageTypeTO.JobErrorResponse)
            {
                ////LOG.Debug("The orchestrator did not successfully acknowledge our job error request!");
                return(false);
            }
            else
            {
                //LOG.Debug("The orchestrator successfully acknowledged our job error response! Better luck next time...");
                return(true);
            }
        }
예제 #2
0
 public void Check(ExtractorReport report)
 {
     if (report.Time > Extraction)
     {
         throw new FailedMutationException("Extraction time above limit: {0}ms", Convert.ToInt32(report.Time * 1000));
     }
 }
예제 #3
0
        void RunExtractorBenchmark()
        {
            Console.WriteLine("Running extractor benchmark");
            ExtractorReport report = ExtractorBenchmark.Run();

            Console.WriteLine("Saving extractor report");
            report.Save("Extractor");
            MatcherBenchmark.TestDatabase = TestDatabase = report.Templates;
        }
예제 #4
0
        public ExtractorReport Run()
        {
            ExtractorReport report = new ExtractorReport();

            report.Templates = Database.Clone();

            int count = 0;
            SerializedFormat serializedFormat = new SerializedFormat();
            CompactFormat    compactFormat    = new CompactFormat();

            Stopwatch timer = new Stopwatch();

            timer.Start();

            foreach (TestDatabase database in report.Templates.Databases)
            {
                foreach (DatabaseIndex index in database.AllIndexes)
                {
#if !MONO
                    byte[,] grayscale = WpfIO.GetPixels(WpfIO.Load(database[index].FilePath));
#else
                    byte[,] grayscale = GdiIO.Load(database[index].FilePath);
#endif
                    TemplateBuilder builder  = Extractor.Extract(grayscale, database.Dpi);
                    Template        template = serializedFormat.Export(builder);
                    database[index].Template = template;

                    report.MinutiaCount += template.Minutiae.Length;
                    report.TemplateSize += compactFormat.Export(builder).Length;
                    ++count;

                    if (timer.Elapsed.TotalSeconds > Timeout)
                    {
                        throw new TimeoutException("Timeout in extractor");
                    }
                }
            }

            timer.Stop();
            report.Time = (float)(timer.Elapsed.TotalSeconds / count);

            report.MinutiaCount /= count;
            report.TemplateSize /= count;
            return(report);
        }
예제 #5
0
        /// <summary>
        /// Send a completed message
        /// </summary>
        /// <param name="config"></param>
        public bool sendJobCompletedRequest(ExtractorConfiguration config, ExtractorReport report, String lastIen)
        {
            // LOG.Debug("Sending orchestrator a notice the job has beeen completed...");
            MessageTO message = new MessageTO()
            {
                ExtractorReport = report,
                Message         = lastIen,
                Configuration   = config,
                MessageType     = MessageTypeTO.JobCompletedRequest
            };
            MessageTO response = submitRequest(message);

            if (response == null || response.MessageType != MessageTypeTO.JobCompletedResponse)
            {
                //LOG.Debug("The orchestrator did not successfully acknowledge our job completed notice!");
                return(false);
            }
            else
            {
                //LOG.Debug("The orchestrator got our job completed notice! We are such a good worker!");
                return(true);
            }
        }
예제 #6
0
        /// <summary>
        /// This method should only be called from a test! It is used to bypass all the server startup, get last IEN, etc. code
        /// </summary>
        /// <param name="report"></param>
        /// <param name="query"></param>
        /// <param name="config"></param>
        /// <param name="fileDao"></param>
        internal void testExecute(ExtractorReport report, VistaQuery query, ExtractorConfiguration config, FileDao fileDao)
        {
            _report     = report;
            _vistaQuery = query;
            _config     = config;
            _fileDao    = fileDao;
            _report.setConfiguration(_config);
            _vistaDao = new VistaDaoImpl();

            // call this to make sure setup is the same
            if (!checkSiteForWork())
            {
                throw new ConfigurationErrorsException("Test execute checkSiteForWork returned false");
            }

            // do this for loop in execute
            _server = new Server(true);
            _server.startListener();

            _serviceState        = new VistaServiceState();
            _serviceState.Status = ServiceStatus.RUNNING;

            this.extract();
        }