deployer = Deployer(resource_group_name, template_path, parameters) deployer.deploy_wait() # region ---- Extract VMs' IPs ---- vms = deployer.compute_client.virtual_machines.list(resource_group_name) vm_names = [] public_hostnames = [] private_hostnames = [] for vm in vms: log.info("VM {}".format(Colors.ok_blue(vm.name))) # Get machine's public address that we can use for SSH-ing public_ip = deployer.network_client.public_ip_addresses.get(resource_group_name, vm.name) public_host_address = public_ip.dns_settings.fqdn public_hostnames.append(public_host_address) log.info("Public host name: {}".format(Colors.ok_green(public_host_address))) # Get machine's private IP address network_interface_id = vm.network_profile.network_interfaces[0].id network_interface_name = network_interface_id.split("/")[-1] network_interface = deployer.network_client.network_interfaces.get(resource_group_name, network_interface_name) private_host_address = network_interface.ip_configurations[0].private_ip_address private_hostnames.append(private_host_address) log.info("Private host name: {}".format(Colors.ok_green(private_host_address))) # endregion # region ---- Setup memcached and memaslap ---- memcached_serve_address = private_hostnames[0] memcached_port = 11211 memcached_server = Memcached(memcached_port, public_hostnames[0])
for repetition in [8]:#range(num_repetitions): R = R_lambda(S) combinations.append((S, R, repetition)) #combinations = [(5, 1, 1)] # override combinations combinations = list(reversed(combinations)) UPDATE_AND_INSTALL = False SKIP_IF_EXISTS = True memaslap_summary_filename = "memaslap_stats.csv" print("Running {} experiments with a maximum of {} minutes per experiment." .format(len(combinations), experiment_runtime+runtime_buffer)) estimated_mins = len(combinations) * experiment_runtime print("Total runtime: {} hours {} minutes".format(estimated_mins // 60, estimated_mins % 60)) eta_string = time.strftime("%H:%M", time.localtime(time.time() + estimated_mins * 60)) print("ETA: {}".format(Colors.bold(Colors.ok_green(eta_string)))) DRY_RUN = False # endregion try: e = Experiment() extractor = Extractor() is_first = True for combination in combinations: S, R, repetition = combination print("Starting experiment with S={} servers, replication R={}, repetition {}" .format(S, R, repetition))
public_hostnames = [] private_hostnames = [] for vm in vms: vm_type = vm.hardware_profile.vm_size vm_types.append(vm_type) vm_names.append(vm.name) log.info("VM {} [{}]".format(Colors.ok_blue(vm.name), vm_type)) # Get machine's public address that we can use for SSH-ing public_ip = deployer.network_client.public_ip_addresses.get( resource_group_name, vm.name) public_host_address = public_ip.dns_settings.fqdn public_hostnames.append(public_host_address) log.info("Public host name: {}".format( Colors.ok_green(public_host_address))) # Get machine's private IP address network_interface_id = vm.network_profile.network_interfaces[0].id network_interface_name = network_interface_id.split("/")[-1] network_interface = deployer.network_client.network_interfaces.get( resource_group_name, network_interface_name) private_host_address = network_interface.ip_configurations[ 0].private_ip_address private_hostnames.append(private_host_address) log.info("Private host name: {}".format( Colors.ok_green(private_host_address))) # endregion # region ---- Set up all machines ----