pub fn start_server() {
    log::info!("starting server");
    // tests sometimes run in parallel, so we wait
    let res = wait_for_ownership(ServerState::Stopped, ServerState::Initializing, Duration::from_secs(5));
    if res.is_err() {
        log::error!("force stopping server, current state is {:#?}", server_state.load());
        stop_server();
    }
    log::info!("aquired server");
    reset_core();
    if get_executor_count() == 0 {
        let num = num_cpus::get();
        // Give them all to the executor, everything else is low-cost overhead
        set_executor_count(num);
        log::info!("setting executor count to {}", num);
    }
    let monitor_factory = SystemMonitorFactory::new();
    let executor_factory = SystemExecutorFactory::new();
    let scheduler_factory = sched_factory::create_sched_factory();
    executor_factory.with_workers(get_executor_count());

    let executor = executor_factory.start(monitor_factory.get_sender(), scheduler_factory.get_sender());
    let monitor = monitor_factory.start(Arc::clone(&executor));
    let scheduler = scheduler_factory.start(monitor_factory.get_sender(), executor_factory.get_queues());

    let mut s = server.borrow_mut();
    s.monitor = ServerField::Monitor(monitor);
    s.scheduler = ServerField::Scheduler(scheduler);
    s.executor = ServerField::Executor(executor);
    server_state.store(ServerState::Running);
    log::info!("server is now running");
}
/// The start_server function starts the server, putting it in a state where it can create machines
/// that are connected to the collective.
The start_server function starts the server, putting it in a state where it can create machines
that are connected to the collective.
The start_server function starts the server putting it in a state where it can create machines that are connected to the collective .
pub fn start_server() {
    log::info!("starting server");
    // tests sometimes run in parallel, so we wait
    let res = wait_for_ownership(ServerState::Stopped, ServerState::Initializing, Duration::from_secs(5));
    if res.is_err() {
        log::error!("force stopping server, current state is {:#?}", server_state.load());
        stop_server();
    }
    log::info!("aquired server");
    reset_core();
    if get_executor_count() == 0 {
        let num = num_cpus::get();
        // Give them all to the executor, everything else is low-cost overhead
        set_executor_count(num);
        log::info!("setting executor count to {}", num);
    }
    let monitor_factory = SystemMonitorFactory::new();
    let executor_factory = SystemExecutorFactory::new();
    let scheduler_factory = sched_factory::create_sched_factory();
    executor_factory.with_workers(get_executor_count());
    let executor = executor_factory.start(monitor_factory.get_sender(), scheduler_factory.get_sender());
    let monitor = monitor_factory.start(Arc::clone(&executor));
    let scheduler = scheduler_factory.start(monitor_factory.get_sender(), executor_factory.get_queues());
    let mut s = server.borrow_mut();
    s.monitor = ServerField::Monitor(monitor);
    s.scheduler = ServerField::Scheduler(scheduler);
    s.executor = ServerField::Executor(executor);
    server_state.store(ServerState::Running);
    log::info!("server is now running");
}
pub fn start_server ( ) { log :: info ! ( " " ) ; // tests sometimes run in parallel, so we wait let res = wait_for_ownership ( ServerState :: Stopped , ServerState :: Initializing , Duration :: from_secs ( 5 ) ) ; if res . is_err ( ) { log :: error ! ( " " server_state load ( ) ) ; stop_server ( ) ; } log :: info ! ( " " ) ; reset_core ( ) ; if get_executor_count ( ) == 0 { let num = num_cpus :: get ( ) ; // Give them all to the executor, everything else is low-cost overhead set_executor_count ( num ) ; log :: info ! ( " " num ) ; } let monitor_factory = SystemMonitorFactory :: new ( ) ; let executor_factory = SystemExecutorFactory :: new ( ) ; let scheduler_factory = sched_factory :: create_sched_factory ( ) ; executor_factory . with_workers ( get_executor_count ( ) ) ; let executor = executor_factory . start ( monitor_factory . get_sender ( ) , scheduler_factory . get_sender ( ) ) ; let monitor = monitor_factory . start ( Arc :: clone ( & executor ) ) ; let scheduler = scheduler_factory . start ( monitor_factory . get_sender ( ) , executor_factory . get_queues ( ) ) ; let mut s = server . borrow_mut ( ) ; s . monitor = ServerField :: Monitor ( monitor ) ; s . scheduler = ServerField :: Scheduler ( scheduler ) ; s . executor = ServerField :: Executor ( executor ) ; server_state . store ( ServerState :: Running ) ; log :: info ! ( " " ) ; }
The start_server function starts the server, putting it in a state where it can create machines
that are connected to the collective.
The start_server function starts the server putting it in a state where it can create machines that are connected to the collective .