/// Handle an end training request for the given client.
///
/// # Returns
///
/// This method returns the response to send back to the client.
Handle an end training request for the given client.
Handle an end training request for the given client .
pub fn end_training(&mut self, id: ClientId, success: bool, client_state: ClientState) {
        info!(
            "end training request: {}({}) (success={})",
            id, client_state, success
        );
        if self.is_training_complete || self.waiting_for_aggregation {
            warn!("got unexpected end training request");
            return;
        }
        if client_state == ClientState::Selected {
            self.counters.selected -= 1;
            if success {
                self.emit_event(Event::SetState(id, ClientState::Done));
                self.counters.done += 1;
                if self.is_end_of_round() {
                    self.emit_event(Event::RunAggregation);
                    self.waiting_for_aggregation = true;
                    info!(
                        counters = %self.counters,
                        "round complete, resetting the clients"
                    );
                    self.emit_event(Event::ResetAll);
                    self.counters.waiting += self.counters.done;
                    self.counters.waiting += self.counters.ignored;
                    self.counters.done_and_inactive = 0;
                    self.counters.done = 0;
                    self.counters.ignored = 0;
                }
            } else {
                self.emit_event(Event::SetState(id, ClientState::Ignored));
                self.counters.ignored += 1;
                info!(counters = %self.counters, "training failed, ignoring participant");
            }
            self.maybe_start_selection();
        }
    }
pub fn end_training ( & mut self , id : ClientId , success : bool , client_state : ClientState ) { info ! ( " " id client_state success ) ; if self . is_training_complete || self . waiting_for_aggregation { warn ! ( " " ) ; return ; } if client_state == ClientState :: Selected { self . counters . selected -= 1 ; if success { self . emit_event ( Event :: SetState ( id , ClientState :: Done ) ) ; self . counters . done += 1 ; if self . is_end_of_round ( ) { self . emit_event ( Event :: RunAggregation ) ; self . waiting_for_aggregation = true ; info ! ( counters self counters " " ) ; self . emit_event ( Event :: ResetAll ) ; self . counters . waiting += self . counters . done ; self . counters . waiting += self . counters . ignored ; self . counters . done_and_inactive = 0 ; self . counters . done = 0 ; self . counters . ignored = 0 ; } } else { self . emit_event ( Event :: SetState ( id , ClientState :: Ignored ) ) ; self . counters . ignored += 1 ; info ! ( counters self counters " " ) ; } self . maybe_start_selection ( ) ; } }
Handle an end training request for the given client.
Handle an end training request for the given client .
This method returns the response to send back to the client.
This method returns the response to send back to the client .
&mut self
id
ClientId
success
bool
client_state
ClientState