Beispiel #1
0
def boot():
    
    if result.temp_dir is not None:
        
        HydrusPaths.SetEnvTempDir( result.temp_dir )
        
    
    controller = None
    
    with HydrusLogger.HydrusLogger( db_dir, 'client' ) as logger:
        
        try:
            
            HydrusData.Print( 'hydrus client started' )
            
            if not HG.twisted_is_broke:
                
                import threading
                
                threading.Thread( target = reactor.run, name = 'twisted', kwargs = { 'installSignalHandlers' : 0 } ).start()
                
            
            from hydrus.client import ClientController
            
            controller = ClientController.Controller( db_dir )
            
            controller.Run()
            
        except:
            
            HydrusData.Print( 'hydrus client failed' )
            
            import traceback
            
            HydrusData.Print( traceback.format_exc() )
            
        finally:
            
            HG.view_shutdown = True
            HG.model_shutdown = True
            
            if controller is not None:
                
                controller.pubimmediate( 'wake_daemons' )
                
            
            if not HG.twisted_is_broke:
                
                reactor.callFromThread( reactor.stop )
                
            
            HydrusData.Print( 'hydrus client shut down' )
            
        
    
    HG.shutdown_complete = True
    
    if HG.restart:
        
        HydrusData.RestartProcess()
Beispiel #2
0
            db_synchronous_override = int(result.db_synchronous_override)

        except ValueError:

            raise Exception(
                'db_synchronous_override must be an integer in the range 0-3')

        if db_synchronous_override not in range(4):

            raise Exception('db_synchronous_override must be in the range 0-3')

    HG.no_db_temp_files = result.no_db_temp_files

    if result.temp_dir is not None:

        HydrusPaths.SetEnvTempDir(result.temp_dir)

    from hydrus.core import HydrusData
    from hydrus.core import HydrusLogger

    try:

        from twisted.internet import reactor

    except:

        HG.twisted_is_broke = True

except Exception as e:

    try: