def configure_clients( iid_fraction: float, instance_names: List[str], num_clients: int, dry_run: bool, delay_factor_fast: float, delay_factor_slow: float, sample_delays: bool = True, real_delays: bool = False, ) -> List[ClientSetting]: """Configure `num_clients` with different delay factors.""" if sample_delays: # Configure clients with sampled delay factors if real_delays: delay_factors = sample_real_delay_factors( num_clients=num_clients, seed=2020 ) else: delay_factors = sample_delay_factors( num_clients=num_clients, max_delay=delay_factor_slow, seed=2020 ) return [ ClientSetting( # Set instance on which to run instance_name=get_instance_name(instance_names, num_clients, i), # Individual cid=str(i), partition=i, delay_factor=delay_factors[i], # Shared iid_fraction=iid_fraction, num_clients=num_clients, dry_run=dry_run, ) for i in range(num_clients) ] # Configure clients with fixed delay factors clients = [] for i in range(num_clients): client = ClientSetting( # Set instance on which to run instance_name=get_instance_name(instance_names, num_clients, i), # Individual cid=str(i), partition=i, # Indices 0 to 49 fast, 50 to 99 slow delay_factor=delay_factor_fast if i < int(num_clients / 2) else delay_factor_slow, # Shared iid_fraction=iid_fraction, num_clients=num_clients, dry_run=dry_run, ) clients.append(client) return clients
def configure_uniform_clients( iid_fraction: float, instance_names: List[str], num_clients: int, dry_run: bool, ) -> List[ClientSetting]: """Configure `num_clients`, all using the same delay factor.""" clients = [] for i in range(num_clients): client = ClientSetting( # Set instance on which to run instance_name=get_instance_name(instance_names, num_clients, i), # Individual cid=str(i), partition=i, delay_factor=0.0, # Shared iid_fraction=iid_fraction, num_clients=num_clients, dry_run=dry_run, ) clients.append(client) return clients