

def invoke(self, args):
    argvs = {f: args.args for f in args.files}
    applications = build_single_handler_applications(args.files, argvs)
    log_level = getattr(logging, args.log_level.upper())
    logging.basicConfig(level=log_level, format=args.log_format)
    if (len(applications) == 0):
        applications['/'] = Application()
    if (args.keep_alive is not None):
        if (args.keep_alive == 0):
            log.info('Keep-alive ping disabled')
        else:
            log.info('Keep-alive ping configured every %d milliseconds', args.keep_alive)
        args.keep_alive_milliseconds = args.keep_alive
    if (args.check_unused_sessions is not None):
        log.info('Check for unused sessions every %d milliseconds', args.check_unused_sessions)
        args.check_unused_sessions_milliseconds = args.check_unused_sessions
    if (args.unused_session_lifetime is not None):
        log.info('Unused sessions last for %d milliseconds', args.unused_session_lifetime)
        args.unused_session_lifetime_milliseconds = args.unused_session_lifetime
    if (args.stats_log_frequency is not None):
        log.info('Log statistics every %d milliseconds', args.stats_log_frequency)
        args.stats_log_frequency_milliseconds = args.stats_log_frequency
    server_kwargs = {key: getattr(args, key) for key in ['port', 'address', 'allow_websocket_origin', 'host', 'prefix', 'develop', 'keep_alive_milliseconds', 'check_unused_sessions_milliseconds', 'unused_session_lifetime_milliseconds', 'stats_log_frequency_milliseconds', 'use_xheaders'] if (getattr(args, key, None) is not None)}
    server_kwargs['sign_sessions'] = settings.sign_sessions()
    server_kwargs['secret_key'] = settings.secret_key_bytes()
    server_kwargs['generate_session_ids'] = True
    if (args.session_ids is None):
        pass
    elif (args.session_ids == 'unsigned'):
        server_kwargs['sign_sessions'] = False
    elif (args.session_ids == 'signed'):
        server_kwargs['sign_sessions'] = True
    elif (args.session_ids == 'external-signed'):
        server_kwargs['sign_sessions'] = True
        server_kwargs['generate_session_ids'] = False
    else:
        raise RuntimeError(('argparse should have filtered out --session-ids mode ' + args.session_ids))
    if (server_kwargs['sign_sessions'] and (not server_kwargs['secret_key'])):
        die(('To sign sessions, the BOKEH_SECRET_KEY environment variable must be set; ' + 'the `bokeh secret` command can be used to generate a new key.'))
    server = Server(applications, **server_kwargs)
    if args.show:

        def show_callback():
            for route in applications.keys():
                server.show(route)
        server.io_loop.add_callback(show_callback)
    if args.develop:
        log.info('Using develop mode (do not enable --develop in production)')
    address_string = ''
    if ((server.address is not None) and (server.address != '')):
        address_string = (' address ' + server.address)
    log.info('Starting Bokeh server on port %d%s with applications at paths %r', args.port, address_string, sorted(applications.keys()))
    log.info(('Starting Bokeh server with process id: %d' % getpid()))
    server.start()

dataset/ETHPy150Open bokeh/bokeh/bokeh/command/subcommands/serve.py Serve.invoke/VarMisuse@561/968 `server`->`args`