예제 #1
0
def shutdown():
    from logs import lg
    from main import config
    from system import bpio
    if _Debug:
        lg.out(_DebugLevel, 'bpmain.shutdown')

    if config.conf():
        config.conf().removeConfigNotifier('logs/debug-level')

    from main import shutdowner
    shutdowner.A('reactor-stopped')

    from main import listeners
    listeners.shutdown()

    from main import events
    events.shutdown()

    from automats import automat
    automat.objects().clear()
    if len(automat.index()) > 0:
        lg.warn('%d automats was not cleaned' % len(automat.index()))
        for a in automat.index().keys():
            if _Debug:
                lg.out(_DebugLevel, '    %r' % a)
    else:
        if _Debug:
            lg.out(
                _DebugLevel,
                'bpmain.shutdown automat.objects().clear() SUCCESS, no state machines left in memory'
            )

    if _Debug:
        lg.out(
            _DebugLevel, 'bpmain.shutdown currently %d threads running:' %
            len(threading.enumerate()))
    for t in threading.enumerate():
        if _Debug:
            lg.out(_DebugLevel, '    ' + str(t))

    if _Debug:
        lg.out(_DebugLevel,
               'bpmain.shutdown finishing and closing log file, EXIT')

    # automat.CloseLogFile()
    automat.SetExceptionsHandler(None)
    automat.SetLogOutputHandler(None)

    lg.close_log_file()

    lg.close_intercepted_log_file()

    lg.stdout_stop_redirecting()
    lg.stderr_stop_redirecting()

    from main import settings
    settings.shutdown()

    return 0
예제 #2
0
def shutdown():
    from logs import lg
    from main import config
    from system import bpio
    lg.out(2, 'bpmain.shutdown')

    import shutdowner
    shutdowner.A('reactor-stopped')

    from automats import automat
    automat.objects().clear()
    if len(automat.index()) > 0:
        lg.warn('%d automats was not cleaned' % len(automat.index()))
        for a in automat.index().keys():
            lg.out(2, '    %r' % a)
    else:
        lg.out(2, 'bpmain.shutdown automat.objects().clear() SUCCESS, no state machines left in memory')

    config.conf().removeCallback('logs/debug-level')

    lg.out(2, 'bpmain.shutdown currently %d threads running:' % len(threading.enumerate()))
    for t in threading.enumerate():
        lg.out(2, '    ' + str(t))

    lg.out(2, 'bpmain.shutdown finishing and closing log file, EXIT')

    automat.CloseLogFile()

    lg.close_log_file()

    if bpio.Windows() and bpio.isFrozen():
        lg.stdout_stop_redirecting()

    return 0
예제 #3
0
def shutdown():
    from logs import lg
    from main import config
    from system import bpio
    lg.out(2, 'bpmain.shutdown')

    from . import shutdowner
    shutdowner.A('reactor-stopped')

    from main import events
    events.shutdown()

    from automats import automat
    automat.objects().clear()
    if len(automat.index()) > 0:
        lg.warn('%d automats was not cleaned' % len(automat.index()))
        for a in automat.index().keys():
            lg.out(2, '    %r' % a)
    else:
        lg.out(
            2,
            'bpmain.shutdown automat.objects().clear() SUCCESS, no state machines left in memory'
        )

    config.conf().removeCallback('logs/debug-level')

    lg.out(
        2, 'bpmain.shutdown currently %d threads running:' %
        len(threading.enumerate()))
    for t in threading.enumerate():
        lg.out(2, '    ' + str(t))

    lg.out(2, 'bpmain.shutdown finishing and closing log file, EXIT')

    automat.CloseLogFile()

    lg.close_log_file()

    if bpio.Windows() and bpio.isFrozen():
        lg.stdout_stop_redirecting()

    return 0