Integrating Flower in Discrete Event Simulation

Hello together!

I have a basic question about how I can use flower in my existing setup/simulation.

I am currently running a discrete event simulation in which data from simulation components is generated at irregular intervals, from which features (and ground truth) are then extracted for a neural network. This data will then be used for learning.

Now, if I understand correctly, the fit() method of the FlowerClient is called by the server. However, my data is available at irregular intervals, which is why training should only take place when this data is available.

Are there procedures in the API for this?

My current approach is to start the client in a separate process, independent of the other simulation components, and wait for the data at the beginning of the fit() method (blocking queue). However, the self.model.fit() call to the Keras model no longer works (infinite wait, although the data from the queue is available). See code snippet.

Am I making a mistake here? Are there better and, most importantly, working approaches?

Thank you in advance for your help!

def fit(self, parameters, config):
        self.model.set_weights(parameters)
        
        """Wait for data and then train the model."""
        print("[Flower Client] Waiting for training data...")

        # Wait until the training data arrives
        x_train, y_train = self.training_data_queue.get()
        print("[Flower Client] training data received")

        self.model.fit(x_train, y_train, epochs=1, batch_size=32)
        print("[Flower Client] Local training completed.")

        # signal training complete
        self.training_complete_event.set()

        return self.get_parameters(), len(self.features), {}