Ejemplo n.º 1
0
    def handle(self, *args, **kwargs):
        if default_connection.ping() is None:
            print 'Redis is unavailable.'
            return

        start = time.time()

        qs = Video.objects.all()[:1000]

        print '"View" videos'
        i = 0
        for video in qs:
            i += 1
            if i % 100 == 0:
                print 'Viewed %s' % i

            st_widget_view_statistic.update(video=video)

        print ''
        print 'Migrate to DB'
        st_widget_view_statistic.migrate(verbosity=2)

        print 'Test migrated data'
        for video in qs:
            views_st = st_widget_view_statistic.get_views(video=video)
            assert video.widget_views_count >= views_st['month'], video.pk

        print time.time() - start
Ejemplo n.º 2
0
 def handle(self, *args, **kwargs):
     if default_connection.ping() is None:
         print 'Redis is unavailable.'
         return
     
     start = time.time()
     
     qs = Video.objects.all()[:1000]
     
     print '"View" videos'
     i = 0
     for video in qs:
         i += 1
         if i % 100 == 0:
             print 'Viewed %s' % i
             
         st_widget_view_statistic.update(video=video)
         
     print ''
     print 'Migrate to DB'
     st_widget_view_statistic.migrate(verbosity=2)
     
     print 'Test migrated data'
     for video in qs:
         views_st = st_widget_view_statistic.get_views(video=video)
         assert video.widget_views_count >= views_st['month'], video.pk
     
     print time.time() - start
Ejemplo n.º 3
0
def st_widget_view_statistic_update(**kwargs):
    st_widget_view_statistic.update(**kwargs)
Ejemplo n.º 4
0
def st_widget_view_statistic_update(*args, **kwargs):
    st_widget_view_statistic.update(*args, **kwargs)