当前位置: 首页>>代码示例>>Python>>正文


Python utils.vtgate_kill函数代码示例

本文整理汇总了Python中utils.vtgate_kill函数的典型用法代码示例。如果您正苦于以下问题:Python vtgate_kill函数的具体用法?Python vtgate_kill怎么用?Python vtgate_kill使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了vtgate_kill函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDownModule

def tearDownModule():
  if utils.options.skip_teardown:
    return

  global vtgate_server
  utils.vtgate_kill(vtgate_server)
  tablet.kill_tablets([shard_0_master, shard_0_replica,
                      shard_1_master, shard_1_replica])
  teardown_procs = [
      shard_0_master.teardown_mysql(),
      shard_0_replica.teardown_mysql(),
      shard_1_master.teardown_mysql(),
      shard_1_replica.teardown_mysql(),
      unsharded_master.teardown_mysql(),
      unsharded_replica.teardown_mysql(),
      ]
  utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server().teardown()
  utils.kill_sub_processes()
  utils.remove_tmp_files()

  shard_0_master.remove_tree()
  shard_0_replica.remove_tree()
  shard_1_master.remove_tree()
  shard_1_replica.remove_tree()
  unsharded_master.remove_tree()
  unsharded_replica.remove_tree()
开发者ID:cihangir,项目名称:vitess,代码行数:28,代码来源:keyspace_test.py

示例2: test_vtgate_qps

  def test_vtgate_qps(self):
    # create the topology
    utils.run_vtctl('CreateKeyspace test_keyspace')
    t = tablet.Tablet(tablet_uid=1, cell="nj")
    t.init_tablet("master", "test_keyspace", "0")
    t.update_addrs()
    utils.run_vtctl('RebuildShardGraph test_keyspace/0', auto_log=True)
    utils.run_vtctl('RebuildKeyspaceGraph test_keyspace', auto_log=True)

    # start vtgate and the qps-er
    vtgate_proc, vtgate_port = utils.vtgate_start()
    qpser = utils.run_bg(utils.vtroot+'/bin/zkclient2 -server localhost:%u -mode qps2 test_nj test_keyspace' % vtgate_port)
    time.sleep(10)
    utils.kill_sub_process(qpser)

    # get the vtgate vars, make sure we have what we need
    v = utils.get_vars(vtgate_port)

    # some checks on performance / stats
    # a typical workstation will do 38-40k QPS, check we have more than 15k
    rpcCalls = v['TopoReaderRpcQueryCount']['test_nj']
    if rpcCalls < 150000:
      self.fail('QPS is too low: %u < 15000' % (rpcCalls / 10))
    else:
      logging.debug("Recorded qps: %u", rpcCalls / 10)
    utils.vtgate_kill(vtgate_proc)
开发者ID:iamima,项目名称:vitess,代码行数:26,代码来源:zkocc_test.py

示例3: test_vtgate_qps

  def test_vtgate_qps(self):
    # create the topology
    utils.run_vtctl('CreateKeyspace test_keyspace')
    t = tablet.Tablet(tablet_uid=1, cell="nj")
    t.init_tablet("master", "test_keyspace", "0")
    t.update_addrs()
    utils.run_vtctl('RebuildKeyspaceGraph test_keyspace', auto_log=True)

    # start vtgate and the qps-er
    vtgate_proc, vtgate_port = utils.vtgate_start(
        extra_args=['-cpu_profile', os.path.join(environment.tmproot,
                                                 'vtgate.pprof')])
    qpser = utils.run_bg(environment.binary_args('zkclient2') + [
        '-server', 'localhost:%u' % vtgate_port,
        '-mode', 'qps',
        '-zkclient_cpu_profile', os.path.join(environment.tmproot, 'zkclient2.pprof'),
        'test_nj', 'test_keyspace'])
    qpser.wait()

    # get the vtgate vars, make sure we have what we need
    v = utils.get_vars(vtgate_port)

    # some checks on performance / stats
    rpcCalls = v['TopoReaderRpcQueryCount']['test_nj']
    if rpcCalls < MIN_QPS * 10:
      self.fail('QPS is too low: %u < %u' % (rpcCalls / 10, MIN_QPS))
    else:
      logging.debug("Recorded qps: %u", rpcCalls / 10)
    utils.vtgate_kill(vtgate_proc)
开发者ID:lcwy220,项目名称:vitess,代码行数:29,代码来源:zkocc_test.py

示例4: tearDownModule

def tearDownModule():
  global vtgate_server
  logging.debug("in tearDownModule")
  if utils.options.skip_teardown:
    return
  logging.debug("Tearing down the servers and setup")
  utils.vtgate_kill(vtgate_server)
  tablet.kill_tablets([shard_0_master, shard_0_replica, shard_1_master,
                       shard_1_replica])
  teardown_procs = [shard_0_master.teardown_mysql(),
                    shard_0_replica.teardown_mysql(),
                    shard_1_master.teardown_mysql(),
                    shard_1_replica.teardown_mysql(),
                   ]
  utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server_teardown()

  utils.kill_sub_processes()
  utils.remove_tmp_files()

  shard_0_master.remove_tree()
  shard_0_replica.remove_tree()
  shard_1_master.remove_tree()
  shard_1_replica.remove_tree()
开发者ID:bill2004158,项目名称:vitess,代码行数:25,代码来源:vtgatev2_test.py

示例5: test_vtgate

  def test_vtgate(self):
    # Start up a master mysql and vttablet
    utils.run_vtctl('CreateKeyspace -force test_keyspace')
    utils.run_vtctl('CreateShard -force test_keyspace/0')
    tablet_62344.init_tablet('master', 'test_keyspace', '0', parent=False)
    utils.run_vtctl('RebuildShardGraph test_keyspace/0')
    utils.run_vtctl('RebuildKeyspaceGraph test_keyspace')
    utils.validate_topology()

    # if these statements don't run before the tablet it will wedge waiting for the
    # db to become accessible. this is more a bug than a feature.
    tablet_62344.mquery("", ["set global read_only = off"])
    tablet_62344.populate('vt_test_keyspace', self._create_vt_select_test,
                          self._populate_vt_select_test)

    tablet_62344.start_vttablet()
    gate_proc = utils.vtgate_start()

    try:
      conn = vtgate.connect("localhost:%s"%(utils.vtgate_port_base), "master", "test_keyspace", "0", 2.0)

      # _execute
      (result, count, lastrow, fields) = conn._execute("select * from vt_select_test", {})
      self.assertEqual(count, 4, "want 4, got %d" % (count))
      self.assertEqual(len(fields), 2, "want 2, got %d" % (len(fields)))

      # _stream_execute
      (result, count, lastrow, fields) = conn._stream_execute("select * from vt_select_test", {})
      self.assertEqual(len(fields), 2, "want 2, got %d" % (len(fields)))
      count = 0
      while 1:
        r = conn._stream_next()
        if not r:
          break
        count += 1
      self.assertEqual(count, 4, "want 4, got %d" % (count))

      # begin-rollback
      conn.begin()
      conn._execute("insert into vt_select_test values(:id, :msg)", {"id": 5, "msg": "test4"})
      conn.rollback()
      (result, count, lastrow, fields) = conn._execute("select * from vt_select_test", {})
      self.assertEqual(count, 4, "want 4, got %d" % (count))

      # begin-commit
      conn.begin()
      conn._execute("insert into vt_select_test values(:id, :msg)", {"id": 5, "msg": "test4"})
      conn.commit()
      (result, count, lastrow, fields) = conn._execute("select * from vt_select_test", {})
      self.assertEqual(count, 5, "want 5, got %d" % (count))

      # close
      conn.close()
    finally:
      utils.vtgate_kill(gate_proc)
      tablet_62344.kill_vttablet()
开发者ID:ZhuoRoger,项目名称:vitess,代码行数:56,代码来源:tabletmanager.py

示例6: shutdown

 def shutdown(self):
   utils.vtgate_kill(self.vtgate_server)
   tablet.kill_tablets(self.tablets)
   teardown_procs = [t.teardown_mysql() for t in self.tablets]
   utils.wait_procs(teardown_procs, raise_on_error=False)
   environment.topo_server().teardown()
   utils.kill_sub_processes()
   utils.remove_tmp_files()
   for t in self.tablets:
     t.remove_tree()
开发者ID:chengc017,项目名称:vitess,代码行数:10,代码来源:java_vtgate_test_helper.py

示例7: tearDownModule

def tearDownModule():
  logging.debug("in tearDownModule")
  if utils.options.skip_teardown:
    return
  logging.debug("Tearing down the servers and setup")
  utils.vtgate_kill(vtgate_server)
  keyspace_env.teardown()

  environment.topo_server().teardown()

  utils.kill_sub_processes()
  utils.remove_tmp_files()
开发者ID:asim,项目名称:vitess,代码行数:12,代码来源:vtgatev3_test.py

示例8: setUp

 def setUp(self):
     global vtgate_server, vtgate_port
     self.shard_index = 0
     self.replica_tablet = shard_0_replica
     self.replica_tablet.kill_vttablet()
     self.replica_tablet.start_vttablet(auth=True)
     utils.vtgate_kill(vtgate_server)
     vtgate_server, vtgate_port = utils.vtgate_start(auth=True)
     credentials_file_name = os.path.join(environment.vttop, "test", "test_data", "authcredentials_test.json")
     credentials_file = open(credentials_file_name, "r")
     credentials = json.load(credentials_file)
     self.user = str(credentials.keys()[0])
     self.password = str(credentials[self.user][0])
     self.secondary_password = str(credentials[self.user][1])
开发者ID:nosix-me,项目名称:vitess,代码行数:14,代码来源:vtdb_test.py

示例9: tearDownModule

def tearDownModule():
  if utils.options.skip_teardown:
    return

  utils.vtgate_kill(vtgate_server)

  teardown_procs = [t.teardown_mysql() for t in tablets]
  utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server_teardown()
  utils.kill_sub_processes()
  utils.remove_tmp_files()

  for t in tablets:
    t.remove_tree()
开发者ID:acid009,项目名称:vitess,代码行数:15,代码来源:vtctld_test.py

示例10: tearDownModule

def tearDownModule():
  if utils.options.skip_teardown:
    return
  logging.debug("Tearing down the servers and setup")
  tablet.kill_tablets([master_tablet, replica_tablet])
  teardown_procs = [master_tablet.teardown_mysql(),
                    replica_tablet.teardown_mysql()]
  utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server_teardown()
  utils.vtgate_kill(vtgate_server)
  utils.kill_sub_processes()
  utils.remove_tmp_files()
  master_tablet.remove_tree()
  replica_tablet.remove_tree()
开发者ID:minmaxflow,项目名称:vitess,代码行数:15,代码来源:rowcache_invalidator.py

示例11: tearDownModule

def tearDownModule():
  global vtgate_server
  global __tablets
  if utils.options.skip_teardown:
    return
  utils.vtgate_kill(vtgate_server)
  if __tablets is not None:
    tablet.kill_tablets(__tablets)
    teardown_procs = []
    for t in __tablets:
      teardown_procs.append(t.teardown_mysql())
    utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server().teardown()

  utils.kill_sub_processes()
  utils.remove_tmp_files()

  if __tablets is not None:
    for t in __tablets:
      t.remove_tree()
开发者ID:egbonrelu,项目名称:vitess-1,代码行数:21,代码来源:client_test.py

示例12: main

def main():
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  options.debug = True
  utils.set_options(options)
  env = keyspace_util.TestEnv()
  vtgate_server=None
  try:
    environment.topo_server().setup()
    env.launch(
        "user",
        shards=["-80", "80-"],
        ddls=[
            'create table user(user_id bigint, name varchar(128), primary key(user_id))',
            'create table user_extra(user_id bigint, extra varchar(128), primary key(user_id))',
            'create table music(user_id bigint, music_id bigint, primary key(user_id, music_id))',
            'create table music_extra(music_id bigint, keyspace_id bigint unsigned, primary key(music_id))',
            ],
        )
    env.launch(
        "lookup",
        ddls=[
            'create table user_idx(user_id bigint not null auto_increment, primary key(user_id))',
            'create table name_user_idx(name varchar(128), user_id bigint, primary key(name, user_id))',
            'create table music_user_idx(music_id bigint not null auto_increment, user_id bigint, primary key(music_id))',
            ],
        )
    utils.apply_vschema(vschema)
    vtgate_server, vtgate_port = utils.vtgate_start(cache_ttl='500s')
    utils.Vtctld().start()
    print "vtgate:", vtgate_port
    print "vtctld:", utils.vtctld.port
    utils.pause("the cluster is up, press enter to shut it down...")
  finally:
    utils.vtgate_kill(vtgate_server)
    env.teardown()
    utils.kill_sub_processes()
    utils.remove_tmp_files()
    environment.topo_server().teardown()
开发者ID:Eter365,项目名称:vitess,代码行数:40,代码来源:demo.py

示例13: tearDownModule

def tearDownModule():
  global vtgate_server

  if utils.options.skip_teardown:
    return

  utils.vtgate_kill(vtgate_server)
  teardown_procs = [
      shard_0_master.teardown_mysql(),
      shard_0_rdonly.teardown_mysql(),
      shard_1_master.teardown_mysql(),
      shard_1_rdonly.teardown_mysql(),
      ]
  utils.wait_procs(teardown_procs, raise_on_error=False)

  environment.topo_server().teardown()
  utils.kill_sub_processes()
  utils.remove_tmp_files()

  shard_0_master.remove_tree()
  shard_0_rdonly.remove_tree()
  shard_1_master.remove_tree()
  shard_1_rdonly.remove_tree()
开发者ID:travis-ci,项目名称:vitess,代码行数:23,代码来源:custom_sharding.py

示例14: tearDown

 def tearDown(self):
   self.vtgate_client.close()
   utils.vtgate_kill(self.vtgate_server)
开发者ID:dvska,项目名称:vitess,代码行数:3,代码来源:vertical_split.py

示例15: restart_vtgate

def restart_vtgate(extra_args={}):
  global vtgate_server, vtgate_port
  utils.vtgate_kill(vtgate_server)
  vtgate_server, vtgate_port = utils.vtgate_start(vtgate_port, extra_args=extra_args)
开发者ID:bill2004158,项目名称:vitess,代码行数:4,代码来源:vtgatev2_test.py


注:本文中的utils.vtgate_kill函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。