def start(root_node, daemonized=False, shutdown_on_last_disconnect=False, thread_pool_size=50,
                interactive=True, logfile=None, socket=None, extra_loggers=None):
    """
    Start web server
    If daemonized, this will start the server in the background,
    and return the socket path.
    """
    # Create node instance
    root_node = root_node()

    # Start server
    socket2 = startSocketServer(root_node, shutdownOnLastDisconnect=shutdown_on_last_disconnect,
                        interactive=interactive, socket=socket, extra_loggers=extra_loggers)

    def set_title(stream_name):
        suffix = (stream_name % ' --log "%s"' if stream_name else '')
        setproctitle('deploy:%s listen --socket "%s"%s' %
                        (root_node.__class__.__name__, socket2, suffix))

    def run_server():
        # Set logging
        stream = None
        if logfile:
            logging.basicConfig(filename=logfile, level=logging.DEBUG)
        elif not daemonized:
            logging.basicConfig(filename='/dev/stdout', level=logging.DEBUG)
        else:
            # If no logging file was given, and we're daemonized, create a temp
            # logfile for monitoring.
            stream = NamedTemporaryFile(delete=True, suffix=socket2.replace('/', '-'))
            logging.basicConfig(stream=stream, level=logging.DEBUG)

        logging.info('Socket server started at %s' % socket2)

        # Thread sensitive interface for stdout/stdin
        std.setup()

        # Set thread pool size (max parrallel interactive processes.)
        if thread_pool_size:
            reactor.suggestThreadPoolSize(thread_pool_size)

        # Set process name
        set_title(stream.name if stream else logfile)

        # Run Twisted reactor
        reactor.run()

        # Remove logging file (this will automatically delete the NamedTemporaryFile)
        if stream:
            stream.close()

    if daemonized:
        if daemonize():
            # In daemon
            run_server()
            sys.exit()
        else:
            # In parent.
            return socket2
    else:
        run_server()
dataset/ETHPy150Open jonathanslenders/python-deployer/deployer/run/socket_server.py/start/swapped operands of `%`