(self, analysis_id)
return result
A wrapper method to run the analyzer.

        This method is decorated to flush the bulk insert operation on the
        datastore. This makes sure that all events are indexed at exit.

        Returns:
            Return value of the run method.
A wrapper method to run the analyzer.
A wrapper method to run the analyzer .
def run_wrapper(self, analysis_id):
        """A wrapper method to run the analyzer.

        This method is decorated to flush the bulk insert operation on the
        datastore. This makes sure that all events are indexed at exit.

        Returns:
            Return value of the run method.
        """
        analysis = Analysis.query.get(analysis_id)
        analysis.set_status('STARTED')

        timeline = analysis.timeline
        self.timeline_name = timeline.name
        searchindex = timeline.searchindex

        counter = 0
        while True:
            status = searchindex.get_status.status
            status = status.lower()
            if status == 'ready':
                break

            if status == 'fail':
                logger.error(
                    'Unable to run analyzer on a failed index ({0:s})'.format(
                        searchindex.index_name))
                return 'Failed'

            time.sleep(self.SECONDS_PER_WAIT)
            counter += 1
            if counter >= self.MAXIMUM_WAITS:
                logger.error(
                    'Indexing has taken too long time, aborting run of '
                    'analyzer')
                return 'Failed'
            # Refresh the searchindex object.
            db_session.refresh(searchindex)

        # Run the analyzer. Broad Exception catch to catch any error and store
        # the error in the DB for display in the UI.
        try:
            result = self.run()
            analysis.set_status('DONE')
        except Exception:  # pylint: disable=broad-except
            analysis.set_status('ERROR')
            result = traceback.format_exc()

        # Update database analysis object with result and status
        analysis.result = '{0:s}'.format(result)
        db_session.add(analysis)
        db_session.commit()

        return result
def run_wrapper ( self , analysis_id ) : analysis = Analysis . query . get ( analysis_id ) analysis . set_status ( 'STARTED' ) timeline = analysis . timeline self . timeline_name = timeline . name searchindex = timeline . searchindex counter = 0 while True : status = searchindex . get_status . status status = status . lower ( ) if status == 'ready' : break if status == 'fail' : logger . error ( 'Unable to run analyzer on a failed index ({0:s})' . format ( searchindex . index_name ) ) return 'Failed' time . sleep ( self . SECONDS_PER_WAIT ) counter += 1 if counter >= self . MAXIMUM_WAITS : logger . error ( 'Indexing has taken too long time, aborting run of ' 'analyzer' ) return 'Failed' # Refresh the searchindex object. db_session . refresh ( searchindex ) # Run the analyzer. Broad Exception catch to catch any error and store # the error in the DB for display in the UI. try : result = self . run ( ) analysis . set_status ( 'DONE' ) except Exception : # pylint: disable=broad-except analysis . set_status ( 'ERROR' ) result = traceback . format_exc ( ) # Update database analysis object with result and status analysis . result = '{0:s}' . format ( result ) db_session . add ( analysis ) db_session . commit ( ) return result