Esempio n. 1
0
def boot():

    if result.temp_dir is not None:

        HydrusTemp.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.started_shutdown = True
            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()
Esempio n. 2
0
        if HG.db_journal_mode == 'WAL':

            HG.db_synchronous = 1

        else:

            HG.db_synchronous = 2

    HG.no_db_temp_files = result.no_db_temp_files

    HG.boot_debug = result.boot_debug

    if result.temp_dir is not None:

        HydrusTemp.SetEnvTempDir(result.temp_dir)

except Exception as e:

    import traceback

    error_trace = traceback.format_exc()

    print(error_trace)

    if 'db_dir' in locals() and os.path.exists(db_dir):

        emergency_dir = db_dir

    else: