(self)
return ('Sessionizing completed, number of session created:'
                ' {0:d}'.format(session_num))
Entry point for the analyzer. Allocates each event a session_id
        attribute.
        Returns:
            String containing the number of sessions created.
Entry point for the analyzer. Allocates each event a session_id
        attribute.
        Returns:
            String containing the number of sessions created.
Entry point for the analyzer . Allocates each event a session_id attribute . Returns : String containing the number of sessions created .
def run(self):
        """Entry point for the analyzer. Allocates each event a session_id
        attribute.
        Returns:
            String containing the number of sessions created.
        """
        return_fields = ['timestamp']

        # 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=return_fields)
        session_num = 0

        try:
            first_event = next(events)
            last_timestamp = first_event.source.get('timestamp')
            session_num = 1
            self.annotateEvent(first_event, session_num)

            for event in events:
                curr_timestamp = event.source.get('timestamp')
                if curr_timestamp - last_timestamp > self.max_time_diff_micros:
                    session_num += 1
                self.annotateEvent(event, session_num)
                last_timestamp = curr_timestamp

        except StopIteration:
            pass

        return ('Sessionizing completed, number of session created:'
                ' {0:d}'.format(session_num))
def run ( self ) : return_fields = [ 'timestamp' ] # 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 = return_fields ) session_num = 0 try : first_event = next ( events ) last_timestamp = first_event . source . get ( 'timestamp' ) session_num = 1 self . annotateEvent ( first_event , session_num ) for event in events : curr_timestamp = event . source . get ( 'timestamp' ) if curr_timestamp - last_timestamp > self . max_time_diff_micros : session_num += 1 self . annotateEvent ( event , session_num ) last_timestamp = curr_timestamp except StopIteration : pass return ( 'Sessionizing completed, number of session created:' ' {0:d}' . format ( session_num ) )