fn start_server(port: Option<u16>) -> Result<String> {
        let bind_ip = env::Configuration::get().local_ip.clone();
        let port = if let Some(bind_port) = port {
            let mut rt = tokio::runtime::Builder::new()
                .enable_all()
                .threaded_scheduler()
                .build()
                .map_err(|_| ShuffleManagerError::FailedToStart)?;
            ShuffleManager::launch_async_runtime(rt, bind_ip, bind_port)?;
            bind_port
        } else {
            let mut port = 0;
            for retry in 0..10 {
                let bind_port = get_dynamic_port();
                let mut rt = tokio::runtime::Builder::new()
                    .enable_all()
                    .threaded_scheduler()
                    .build()
                    .map_err(|_| ShuffleManagerError::FailedToStart)?;
                if let Ok(server) = ShuffleManager::launch_async_runtime(rt, bind_ip, bind_port) {
                    port = bind_port;
                    break;
                } else if retry == 9 {
                    return Err(ShuffleManagerError::FreePortNotFound(bind_port));
                }
            }
            port
        };
        let server_uri = format!(
            "http://{}:{}",
            env::Configuration::get().local_ip.clone(),
            port,
        );
        log::debug!("server_uri {:?}", server_uri);
        Ok(server_uri)
    }
/// Returns the shuffle server URI as a string.
Returns the shuffle server URI as a string.
Returns the shuffle server URI as a string .
fn start_server(port: Option<u16>) -> Result<String> {
        let bind_ip = env::Configuration::get().local_ip.clone();
        let port = if let Some(bind_port) = port {
            let mut rt = tokio::runtime::Builder::new()
                .enable_all()
                .threaded_scheduler()
                .build()
                .map_err(|_| ShuffleManagerError::FailedToStart)?;
            ShuffleManager::launch_async_runtime(rt, bind_ip, bind_port)?;
            bind_port
        } else {
            let mut port = 0;
            for retry in 0..10 {
                let bind_port = get_dynamic_port();
                let mut rt = tokio::runtime::Builder::new()
                    .enable_all()
                    .threaded_scheduler()
                    .build()
                    .map_err(|_| ShuffleManagerError::FailedToStart)?;
                if let Ok(server) = ShuffleManager::launch_async_runtime(rt, bind_ip, bind_port) {
                    port = bind_port;
                    break;
                } else if retry == 9 {
                    return Err(ShuffleManagerError::FreePortNotFound(bind_port));
                }
            }
            port
        };
        let server_uri = format!(
            "http://{}:{}",
            env::Configuration::get().local_ip.clone(),
            port,
        );
        log::debug!("server_uri {:?}", server_uri);
        Ok(server_uri)
    }
fn start_server ( port : Option < u16 > ) -> Result < String > { let bind_ip = env :: Configuration :: get ( ) . local_ip . clone ( ) ; let port = if let Some ( bind_port ) = port { let mut rt = tokio :: runtime :: Builder :: new ( ) . enable_all ( ) . threaded_scheduler ( ) . build ( ) . map_err ( | _ | ShuffleManagerError :: FailedToStart ) ? ; ShuffleManager :: launch_async_runtime ( rt , bind_ip , bind_port ) ? ; bind_port } else { let mut port = 0 ; for retry in 0 .. 10 { let bind_port = get_dynamic_port ( ) ; let mut rt = tokio :: runtime :: Builder :: new ( ) . enable_all ( ) . threaded_scheduler ( ) . build ( ) . map_err ( | _ | ShuffleManagerError :: FailedToStart ) ? ; if let Ok ( server ) = ShuffleManager :: launch_async_runtime ( rt , bind_ip , bind_port ) { port = bind_port ; break ; } else if retry == 9 { return Err ( ShuffleManagerError :: FreePortNotFound ( bind_port ) ) ; } } port } ; let server_uri = format ! ( " " env Configuration get ( ) local_ip clone ( ) port ) ; log :: debug ! ( " " server_uri ) ; Ok ( server_uri ) }
Returns the shuffle server URI as a string.
Returns the shuffle server URI as a string .
port
Option<u16>