def Prepare(benchmark_spec):
  """Prepare the virtual machines to run cloud bigtable.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  benchmark_spec.always_call_cleanup = True
  vms = benchmark_spec.vms

  # TODO: in the future, it might be nice to change this so that
  # a gcp_bigtable.GcpBigtableInstance can be created with an
  # flag that says don't create/delete the instance.  That would
  # reduce the code paths here.
  if FLAGS.google_bigtable_instance_name is None:
    instance_name = 'pkb-bigtable-{0}'.format(FLAGS.run_uri)
    project = FLAGS.project or _GetDefaultProject()
    logging.info('Creating bigtable instance %s', instance_name)
    zone = FLAGS.google_bigtable_zone_name
    benchmark_spec.bigtable_instance = gcp_bigtable.GcpBigtableInstance(
        instance_name, CLUSTER_SIZE, project, zone)
    benchmark_spec.bigtable_instance.Create()
    instance = _GetInstanceDescription(project, instance_name)
    logging.info('Instance %s created successfully', instance)

  vm_util.RunThreaded(_Install, vms)

  # Create table
  hbase_ycsb.CreateYCSBTable(vms[0], table_name=_GetTableName(),
                             use_snappy=False, limit_filesize=False)
예제 #2
0
def Prepare(benchmark_spec):
    """Prepare the virtual machines to run cloud bigtable.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
    benchmark_spec.always_call_cleanup = True
    vms = benchmark_spec.vms
    if FLAGS.google_bigtable_enable_table_object_sharing:
        ycsb.SetYcsbTarUrl(YCSB_BIGTABLE_TABLE_SHARING_TAR_URL)

    # TODO: in the future, it might be nice to change this so that
    # a gcp_bigtable.GcpBigtableInstance can be created with an
    # flag that says don't create/delete the instance.  That would
    # reduce the code paths here.
    if FLAGS.google_bigtable_instance_name is None:
        instance_name = 'pkb-bigtable-{0}'.format(FLAGS.run_uri)
        project = FLAGS.project or _GetDefaultProject()
        logging.info('Creating bigtable instance %s', instance_name)
        zone = FLAGS.google_bigtable_zone
        benchmark_spec.bigtable_instance = gcp_bigtable.GcpBigtableInstance(
            instance_name, project, zone)
        benchmark_spec.bigtable_instance.Create()
        instance = _GetInstanceDescription(project, instance_name)
        logging.info('Instance %s created successfully', instance)

    vm_util.RunThreaded(_Install, vms)

    table_name = _GetTableName()
    # If the table already exists, it will be an no-op.
    hbase_ycsb.CreateYCSBTable(vms[0],
                               table_name=table_name,
                               use_snappy=False,
                               limit_filesize=False)

    # Add hbase conf dir to the classpath.
    ycsb_memory = min(vms[0].total_memory_kb // 1024, 4096)
    jvm_args = pipes.quote(' -Xmx{0}m'.format(ycsb_memory))

    executor_flags = {
        'cp': hbase.HBASE_CONF_DIR,
        'jvm-args': jvm_args,
        'table': table_name
    }

    benchmark_spec.executor = ycsb.YCSBExecutor('hbase10', **executor_flags)
 def setUp(self):
     super(GcpBigtableTestCase, self).setUp()
     self.bigtable = gcp_bigtable.GcpBigtableInstance(NAME, PROJECT, ZONE)
예제 #4
0
 def setUp(self):
     super(GcpBigtableTestCase, self).setUp()
     self.bigtable = gcp_bigtable.GcpBigtableInstance(
         NAME, NUM_NODES, PROJECT, ZONE)
     self.flags = mock_flags.PatchTestCaseFlags(self)