(self)
return ('Sessionizing completed, number of {0:s} sessions created:'
                ' {1:d}'.format(self.session_type, self.session_num))
Entry point for the analyzer.

        Allocates each event between the first event of the event_seq and the
        last event of the event_seq an session_type attribute with a value
        session_num.

        Returns:
            String containing the name of the event sequence and the
            number of sessions created.
Entry point for the analyzer.
Entry point for the analyzer .
def run(self):
        """Entry point for the analyzer.

        Allocates each event between the first event of the event_seq and the
        last event of the event_seq an session_type attribute with a value
        session_num.

        Returns:
            String containing the name of the event sequence and the
            number of sessions created.
        """
        if self.session_type is None or self.session_type == '':
            raise ValueError('No session_type provided.')
        if self.event_seq is None or self.event_seq == []:
            raise ValueError('No event_seq provided.')
        # If return_fields in None, then all attributes are provided.
        if self.return_fields is not None:
            self.build_return_fields()

        # event_stream returns an ordered generator of events (by time)
        # therefore no further sorting is needed.
        events = self.event_stream(query_string=self.query,
                                   return_fields=self.return_fields)

        last_timestamp = None
        for event in events:
            curr_timestamp = event.source.get('timestamp')
            if last_timestamp and \
                (curr_timestamp - last_timestamp > self.max_time_diff_micros):
                self.flush_events(drop=True)
            self.process_event(event)
            last_timestamp = curr_timestamp

        self.sketch.add_view('Session view',
                             self.NAME,
                             query_string='session_id.{0:s}:*'.format(
                                 self.session_type))

        return ('Sessionizing completed, number of {0:s} sessions created:'
                ' {1:d}'.format(self.session_type, self.session_num))
def run ( self ) : if self . session_type is None or self . session_type == '' : raise ValueError ( 'No session_type provided.' ) if self . event_seq is None or self . event_seq == [ ] : raise ValueError ( 'No event_seq provided.' ) # If return_fields in None, then all attributes are provided. if self . return_fields is not None : self . build_return_fields ( ) # event_stream returns an ordered generator of events (by time) # therefore no further sorting is needed. events = self . event_stream ( query_string = self . query , return_fields = self . return_fields ) last_timestamp = None for event in events : curr_timestamp = event . source . get ( 'timestamp' ) if last_timestamp and ( curr_timestamp - last_timestamp > self . max_time_diff_micros ) : self . flush_events ( drop = True ) self . process_event ( event ) last_timestamp = curr_timestamp self . sketch . add_view ( 'Session view' , self . NAME , query_string = 'session_id.{0:s}:*' . format ( self . session_type ) ) return ( 'Sessionizing completed, number of {0:s} sessions created:' ' {1:d}' . format ( self . session_type , self . session_num ) )