示例#1
0
def Prepare(benchmark_spec):
  """Prepare the launcher server vm(s).

  Prepare the launcher server vm(s) by:
  1) Build the script that each launcher server will use to kick off boot.
  2) Start a listening server to wait for booting vms.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
      required to run the benchmark.
  """
  benchmark_spec.always_call_cleanup = True
  launcher_vms = benchmark_spec.vm_groups['servers']
  booter_template_vm = benchmark_spec.vm_groups['clients'][0]
  # Setup account/IAM credentials/permissions on launcher servers.
  if FLAGS.cloud == 'GCP':
    for vm in launcher_vms:
      gcp_util.AuthenticateServiceAccount(vm, benchmark=BENCHMARK_NAME)

  # fail early if launched VMs exceeds more than 50 per vcpu.
  # High CPU usage can negatively impact measured boot times.
  if FLAGS.boots_per_launcher > (launcher_vms[0].num_cpus * 50):
    raise errors.Setup.InvalidConfigurationError(
        'Each launcher server VM is launching too many VMs. '
        'Increase launcher server VM size or decrease boots_per_launcher. '
        'For a VM with {} CPUs, launch at most {} VMs.'.format(
            launcher_vms[0].num_cpus, launcher_vms[0].num_cpus * 50))

  vm_util.RunThreaded(
      lambda vm: _Install(vm, booter_template_vm), launcher_vms)
def Prepare(benchmark_spec):
    """Prepare the launcher server vm(s).

  Prepare the launcher server vm(s) by:
  1) Build the script that each launcher server will use to kick off boot.
  2) Start a listening server to wait for booting vms.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
      required to run the benchmark.
  """
    benchmark_spec.always_call_cleanup = True
    launcher_vms = benchmark_spec.vm_groups['servers']
    booter_template_vm = benchmark_spec.vm_groups['clients'][0]
    # Setup account/IAM credentials/permissions on launcher servers.
    if FLAGS.cloud == 'GCP':
        for vm in launcher_vms:
            gcp_util.AuthenticateServiceAccount(vm, benchmark=BENCHMARK_NAME)

    # fail early if launched VMs exceeds more than 50 per vcpu.
    # High CPU usage can negatively impact measured boot times.
    if FLAGS.boots_per_launcher > (launcher_vms[0].num_cpus * 50):
        raise errors.Setup.InvalidConfigurationError(
            'Each launcher server VM is launching too many VMs. '
            'Increase launcher server VM size or decrease boots_per_launcher. '
            'For a VM with {} CPUs, launch at most {} VMs.'.format(
                launcher_vms[0].num_cpus, launcher_vms[0].num_cpus * 50))

    if FLAGS.cloud == 'Azure':
        used_private_ips = _AZURE_RESERVED_IPS + FLAGS.num_vms
        for i in range(used_private_ips,
                       used_private_ips + _GetExpectedBoots()):
            nic_name_prefix = _BOOT_NIC_NAME_PREFIX.format(
                run_uri=FLAGS.run_uri)
            private_ip = '10.0.{octet3}.{octet4}'.format(octet3=i // 256,
                                                         octet4=i % 256)
            public_ip_name = ''
            if FLAGS.use_public_ip:
                public_ip = azure_virtual_machine.AzurePublicIPAddress(
                    launcher_vms[0].region, launcher_vms[0].availability_zone,
                    '{}-public-ip'.format(i),
                    'booter-{}-{}'.format(FLAGS.run_uri, i))
                public_ip.Create()
                public_ip_name = public_ip.name
            nic = azure_virtual_machine.AzureNIC(
                subnet=launcher_vms[0].network.subnet,
                name=nic_name_prefix + str(i),
                public_ip=public_ip_name,
                accelerated_networking=False,
                network_security_group=None,
                private_ip=private_ip)
            nic.Create()

    vm_util.RunThreaded(lambda vm: _Install(vm, booter_template_vm),
                        launcher_vms)
示例#3
0
    def InstallAndAuthenticateRunner(self, vm):
        """Method to perform installation and authentication of bigquery runner.

    Native Bigquery client that ships with the google_cloud_sdk
    https://cloud.google.com/bigquery/docs/bq-command-line-too used as client.

    Args:
      vm: Client vm on which the script will be run.
    """
        vm.Install('google_cloud_sdk')
        gcp_util.AuthenticateServiceAccount(vm)
    def InstallAndAuthenticateRunner(self, vm, benchmark_name):
        """Method to perform installation and authentication of bigquery runner.

    Native Bigquery client that ships with the google_cloud_sdk
    https://cloud.google.com/bigquery/docs/bq-command-line-tool used as client.

    Args:
      vm: Client vm on which the script will be run.
      benchmark_name: String name of the benchmark, to allow extraction and
        usage of benchmark specific artifacts (certificates, etc.) during client
        vm preparation.
    """
        vm.Install('google_cloud_sdk')
        gcp_util.AuthenticateServiceAccount(vm, benchmark=benchmark_name)