Example #1
0
    def run_and_watch( self, command, *args, **kwargs ):
        parent_command = getattr( super( SearchBackend, self ), command )
        self_command = getattr( self, command )
        please_raise = kwargs.pop( 'please_raise' ) if kwargs.has_key( 'please_raise' ) else False
        try:
            return parent_command( *args, **kwargs )
        except ( IOError, SolrError, socket.error ), e:
            if please_raise:
                raise

            from film20.search.solr_helper import build_daemon
            daemon = build_daemon()
            if not daemon.is_active():
                logger.info( "Ups, solr is probably dead restarting ..." )
                daemon.restart( force=True)
                kwargs['please_raise'] = True
                return self_command( *args, **kwargs )
Example #2
0
class SolrStats( TemplateView ):
    template_name = "search/stats.html"

    def get_context_data( self, *args, **kwargs ):
        try:
            from film20.search.solr_helper import build_daemon, configuration, is_supported
            is_supported = is_supported()
        except Exception, e:
            is_supported = False

        daemon = build_daemon()
        context = super( SolrStats, self ).get_context_data( *args, **kwargs )
        context.update({
            'solr': daemon,
            'is_supported': is_supported,
            'configuration': configuration,
            'queue': QueuedItem.objects.get_for_language().count()
        })
        return context
Example #3
0
 def handle(self, **options):
     try:
         from film20.search.solr_helper import build_daemon
         daemon = build_daemon()
     except Exception, e:
         raise CommandError(e)
Example #4
0
 def handle( self, **options ):
     try:
         from film20.search.solr_helper import build_daemon
         daemon = build_daemon()
     except Exception, e:
         raise CommandError( e )
Example #5
0
 def setUp(self):
     from film20.search.solr_helper import build_daemon
     self.daemon = build_daemon()
Example #6
0
 def setUp( self ):
     from film20.search.solr_helper import build_daemon
     self.daemon = build_daemon()