Beispiel #1
0
def main():  # pragma: no cover
    args = parser.parse_args()
    ctx.load_args(args)
    from spruned import settings
    from spruned.application.tools import create_directory
    create_directory(ctx, settings.STORAGE_ADDRESS)

    from daemonize import Daemonize
    from spruned.main import main_task

    def start():  # pragma: no cover
        from spruned.application.logging_factory import Logger
        Logger.root.debug('Arguments: %s', args)
        main_loop = asyncio.get_event_loop()
        main_loop.create_task(main_task(main_loop))
        main_loop.run_forever()

    if args.daemonize:
        from spruned.application.logging_factory import Logger
        pid = ctx.datadir + '/spruned.pid'
        Logger.root.debug('Running spruned daemon')
        daemon = Daemonize(app="spruned",
                           pid=pid,
                           action=start,
                           logger=Logger.root,
                           auto_close_fds=False)
        daemon.start()
    else:
        start()
Beispiel #2
0
 def start():  # pragma: no cover
     from spruned.application.logging_factory import Logger
     Logger.root.debug('Arguments: %s', args)
     create_directory(ctx, settings.STORAGE_ADDRESS)
     main_loop = asyncio.get_event_loop()
     main_loop.create_task(main_task(main_loop))
     main_loop.run_forever()
Beispiel #3
0
 def start():  # pragma: no cover
     ctx.load_args(args)
     create_directory()
     main_loop = asyncio.get_event_loop()
     from spruned.main import main_task
     main_loop.create_task(main_task(main_loop))
     main_loop.run_forever()
    def main():  # pragma: no cover
        args = parser.parse_args()
        ctx.load_args(args)
        from spruned import settings
        from spruned.application.tools import create_directory
        create_directory(ctx, settings.STORAGE_ADDRESS)

        from spruned.main import main_task

        def start():  # pragma: no cover
            from spruned.application.logging_factory import Logger
            from spruned.application.database import sqlite
            from spruned.builder import repository

            migrations.run(sqlite)

            version = repository.blockchain.get_db_version()
            if version != repository.blockchain.current_version:
                Logger.root.debug('Erasing database because of wrong version')
                repository.blockchain.erase()

            if args.daemon:
                MSG = 'Warning! --daemon is deprecated and will be removed in' \
                      ' future versions. Use an init script, instead.\n'
                Logger.root.warning(MSG)
            Logger.root.debug('Arguments: %s', args)
            main_loop = asyncio.get_event_loop()
            main_loop.create_task(main_task(main_loop))
            main_loop.run_forever()

        start()