本文整理汇总了Python中utils.wait_procs函数的典型用法代码示例。如果您正苦于以下问题:Python wait_procs函数的具体用法?Python wait_procs怎么用?Python wait_procs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wait_procs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_no_mysql_healthcheck
def test_no_mysql_healthcheck(self):
"""This test starts a vttablet with no mysql port, while mysql is down.
It makes sure vttablet will start properly and be unhealthy.
Then we start mysql, and make sure vttablet becomes healthy.
"""
# we need replication to be enabled, so the slave tablet can be healthy.
for t in tablet_62344, tablet_62044:
t.create_db("vt_test_keyspace")
pos = mysql_flavor().master_position(tablet_62344)
changeMasterCmds = mysql_flavor().change_master_commands(utils.hostname, tablet_62344.mysql_port, pos)
tablet_62044.mquery("", ["RESET MASTER", "RESET SLAVE"] + changeMasterCmds + ["START SLAVE"])
# now shutdown all mysqld
shutdown_procs = [tablet_62344.shutdown_mysql(), tablet_62044.shutdown_mysql()]
utils.wait_procs(shutdown_procs)
# start the tablets, wait for them to be NOT_SERVING (mysqld not there)
tablet_62344.init_tablet("master", "test_keyspace", "0")
tablet_62044.init_tablet("spare", "test_keyspace", "0", include_mysql_port=False)
for t in tablet_62344, tablet_62044:
t.start_vttablet(
wait_for_state=None, target_tablet_type="replica", full_mycnf_args=True, include_mysql_port=False
)
for t in tablet_62344, tablet_62044:
t.wait_for_vttablet_state("NOT_SERVING")
self.check_healthz(t, False)
# restart mysqld
start_procs = [tablet_62344.start_mysql(), tablet_62044.start_mysql()]
utils.wait_procs(start_procs)
# the master should still be healthy
utils.run_vtctl(["RunHealthCheck", tablet_62344.tablet_alias, "replica"], auto_log=True)
self.check_healthz(tablet_62344, True)
# the slave won't be healthy at first, as replication is not running
utils.run_vtctl(["RunHealthCheck", tablet_62044.tablet_alias, "replica"], auto_log=True)
self.check_healthz(tablet_62044, False)
tablet_62044.wait_for_vttablet_state("NOT_SERVING")
# restart replication
tablet_62044.mquery("", ["START SLAVE"])
# wait for the tablet to become healthy and fix its mysql port
utils.run_vtctl(["RunHealthCheck", tablet_62044.tablet_alias, "replica"], auto_log=True)
tablet_62044.wait_for_vttablet_state("SERVING")
self.check_healthz(tablet_62044, True)
for t in tablet_62344, tablet_62044:
# wait for mysql port to show up
timeout = 10
while True:
ti = utils.run_vtctl_json(["GetTablet", t.tablet_alias])
if "mysql" in ti["Portmap"]:
break
timeout = utils.wait_step("mysql port in tablet record", timeout)
self.assertEqual(ti["Portmap"]["mysql"], t.mysql_port)
# all done
tablet.kill_tablets([tablet_62344, tablet_62044])
开发者ID:pranjal5215,项目名称:vitess,代码行数:60,代码来源:tabletmanager.py
示例2: tearDownModule
def tearDownModule():
if utils.options.skip_teardown:
return
teardown_procs = [
tablet_62344.teardown_mysql(),
tablet_62044.teardown_mysql(),
tablet_41983.teardown_mysql(),
tablet_31981.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
utils.zk_teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
tablet_62344.remove_tree()
tablet_62044.remove_tree()
tablet_41983.remove_tree()
tablet_31981.remove_tree()
path = os.path.join(utils.vtdataroot, 'snapshot')
try:
shutil.rmtree(path)
except OSError as e:
logging.debug("removing snapshot %s: %s", path, str(e))
开发者ID:521wangzhifeng,项目名称:vitess,代码行数:26,代码来源:tabletmanager.py
示例3: 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
示例4: setup
def setup():
utils.zk_setup()
# start mysql instance external to the test
setup_procs = [master_tablet.init_mysql(), replica_tablet.init_mysql()]
utils.wait_procs(setup_procs)
setup_tablets()
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:update_stream.py
示例5: tearDownModule
def tearDownModule():
if utils.options.skip_teardown:
return
teardown_procs = [
shard_0_master.teardown_mysql(),
shard_0_replica1.teardown_mysql(),
shard_0_replica2.teardown_mysql(),
shard_0_rdonly.teardown_mysql(),
shard_0_backup.teardown_mysql(),
shard_1_master.teardown_mysql(),
shard_1_replica1.teardown_mysql(),
shard_2_master.teardown_mysql(),
shard_2_replica1.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_replica1.remove_tree()
shard_0_replica2.remove_tree()
shard_0_rdonly.remove_tree()
shard_0_backup.remove_tree()
shard_1_master.remove_tree()
shard_1_replica1.remove_tree()
shard_2_master.remove_tree()
shard_2_replica1.remove_tree()
开发者ID:Eter365,项目名称:vitess,代码行数:30,代码来源:schema.py
示例6: setUpModule
def setUpModule():
try:
environment.topo_server().setup()
setup_procs = [
shard_master.init_mysql(),
shard_replica.init_mysql(),
shard_rdonly1.init_mysql(),
shard_0_master.init_mysql(),
shard_0_replica.init_mysql(),
shard_0_rdonly1.init_mysql(),
shard_1_master.init_mysql(),
shard_1_replica.init_mysql(),
shard_1_rdonly1.init_mysql(),
]
utils.wait_procs(setup_procs)
init_keyspace()
logging.debug('environment set up with the following shards and tablets:')
logging.debug('=========================================================')
logging.debug('TABLETS: test_keyspace/0:\n%s', all_shard_tablets)
logging.debug('TABLETS: test_keyspace/-80:\n%s', shard_0_tablets)
logging.debug('TABLETS: test_keyspace/80-:\n%s', shard_1_tablets)
except:
tearDownModule()
raise
开发者ID:DalianDragon,项目名称:vitess,代码行数:25,代码来源:worker.py
示例7: tearDownModule
def tearDownModule():
if utils.options.skip_teardown:
return
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:Rastusik,项目名称:vitess,代码行数:26,代码来源:keyspace_test.py
示例8: teardown
def teardown():
if utils.options.skip_teardown:
return
teardown_procs = [
shard_0_master.teardown_mysql(),
shard_0_replica.teardown_mysql(),
shard_1_master.teardown_mysql(),
shard_1_replica.teardown_mysql(),
shard_2_master.teardown_mysql(),
shard_2_replica.teardown_mysql(),
shard_3_master.teardown_mysql(),
shard_3_replica.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
utils.zk_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()
shard_2_master.remove_tree()
shard_2_replica.remove_tree()
shard_3_master.remove_tree()
shard_3_replica.remove_tree()
开发者ID:Eric-Chen,项目名称:vitess,代码行数:28,代码来源:resharding.py
示例9: setUpModule
def setUpModule():
try:
environment.topo_server_setup()
setup_procs = [
shard_0_master.init_mysql(),
shard_0_replica.init_mysql(),
shard_0_ny_slave.init_mysql(),
shard_1_master.init_mysql(),
shard_1_slave1.init_mysql(),
shard_1_slave2.init_mysql(),
shard_1_ny_slave.init_mysql(),
shard_1_rdonly.init_mysql(),
shard_2_master.init_mysql(),
shard_2_replica1.init_mysql(),
shard_2_replica2.init_mysql(),
shard_3_master.init_mysql(),
shard_3_replica.init_mysql(),
shard_3_rdonly.init_mysql(),
]
utils.Vtctld().start()
utils.wait_procs(setup_procs)
except:
tearDownModule()
raise
开发者ID:nangong92t,项目名称:go_src,代码行数:25,代码来源:resharding.py
示例10: tearDownModule
def tearDownModule():
if utils.options.skip_teardown:
return
tablet.kill_tablets([src_master, src_replica, src_rdonly1, src_rdonly2,
dst_master, dst_replica])
teardown_procs = [
src_master.teardown_mysql(),
src_replica.teardown_mysql(),
src_rdonly1.teardown_mysql(),
src_rdonly2.teardown_mysql(),
dst_master.teardown_mysql(),
dst_replica.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
environment.topo_server().teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
src_master.remove_tree()
src_replica.remove_tree()
src_rdonly1.remove_tree()
src_rdonly2.remove_tree()
dst_master.remove_tree()
dst_replica.remove_tree()
开发者ID:haoqoo,项目名称:vitess,代码行数:27,代码来源:binlog.py
示例11: teardown
def teardown():
if utils.options.skip_teardown:
return
teardown_procs = [
tablet_62344.teardown_mysql(),
tablet_62044.teardown_mysql(),
tablet_41983.teardown_mysql(),
tablet_31981.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
utils.zk_teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
tablet_62344.remove_tree()
tablet_62044.remove_tree()
tablet_41983.remove_tree()
tablet_31981.remove_tree()
path = os.path.join(utils.vtdataroot, 'snapshot')
try:
shutil.rmtree(path)
except OSError as e:
if utils.options.verbose:
print >> sys.stderr, e, path
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:27,代码来源:tabletmanager.py
示例12: set_up
def set_up(self):
try:
environment.topo_server_setup()
utils.wait_procs([t.init_mysql() for t in self.tablets])
utils.run_vtctl(['CreateKeyspace', self.keyspace])
utils.run_vtctl(['SetKeyspaceShardingInfo', '-force', self.keyspace, 'keyspace_id', 'uint64'])
for t in self.tablets:
t.init_tablet(t.type, keyspace=self.keyspace, shard=t.shard)
utils.run_vtctl(['RebuildKeyspaceGraph', self.keyspace], auto_log=True)
for t in self.tablets:
t.create_db('vt_' + self.keyspace)
t.mquery(t.dbname, create_table)
t.start_vttablet(wait_for_state=None)
for t in self.tablets:
t.wait_for_vttablet_state('SERVING')
for t in self.tablets:
if t.type == "master":
utils.run_vtctl(['ReparentShard', '-force', self.keyspace+'/'+t.shard, t.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', self.keyspace], auto_log=True)
self.vtgate_server, self.vtgate_port = utils.vtgate_start()
vtgate_client = zkocc.ZkOccConnection("localhost:%u" % self.vtgate_port, "test_nj", 30.0)
topology.read_topology(vtgate_client)
except:
self.shutdown()
raise
开发者ID:delphi329,项目名称:vitess,代码行数:25,代码来源:java_vtgate_test_helper.py
示例13: tearDownModule
def tearDownModule():
logging.debug("in tearDownModule")
if utils.options.skip_teardown:
return
logging.debug("Tearing down the servers and setup")
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)
utils.zk_teardown()
shard_0_master.kill_vttablet()
shard_0_replica.kill_vttablet()
shard_1_master.kill_vttablet()
shard_1_replica.kill_vttablet()
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:CERN-Stage-3,项目名称:vitess,代码行数:25,代码来源:vtdb_test.py
示例14: teardown
def teardown(self):
all_tablets = self.tablet_map.values()
tablet.kill_tablets(all_tablets)
teardown_procs = [t.teardown_mysql() for t in all_tablets]
utils.wait_procs(teardown_procs, raise_on_error=False)
for t in all_tablets:
t.remove_tree()
开发者ID:MirkoSchiavone,项目名称:vitess,代码行数:7,代码来源:keyspace_util.py
示例15: tearDownModule
def tearDownModule():
if utils.options.skip_teardown:
return
if use_mysqlctld:
# Try to terminate mysqlctld gracefully, so it kills its mysqld.
for proc in setup_procs:
utils.kill_sub_process(proc, soft=True)
teardown_procs = setup_procs
else:
teardown_procs = [
tablet_62344.teardown_mysql(),
tablet_31981.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
environment.topo_server().teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
tablet_62344.remove_tree()
tablet_31981.remove_tree()
path = os.path.join(environment.vtdataroot, 'snapshot')
try:
shutil.rmtree(path)
except OSError as e:
logging.debug("removing snapshot %s: %s", path, str(e))
开发者ID:Eter365,项目名称:vitess,代码行数:28,代码来源:clone.py
示例16: tearDownModule
def tearDownModule():
utils.required_teardown()
if utils.options.skip_teardown:
return
if utils.vtgate:
utils.vtgate.kill()
teardown_procs = [
source_master.teardown_mysql(),
source_replica.teardown_mysql(),
source_rdonly1.teardown_mysql(),
source_rdonly2.teardown_mysql(),
destination_master.teardown_mysql(),
destination_replica.teardown_mysql(),
destination_rdonly1.teardown_mysql(),
destination_rdonly2.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
environment.topo_server().teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
source_master.remove_tree()
source_replica.remove_tree()
source_rdonly1.remove_tree()
source_rdonly2.remove_tree()
destination_master.remove_tree()
destination_replica.remove_tree()
destination_rdonly1.remove_tree()
destination_rdonly2.remove_tree()
开发者ID:benyu,项目名称:vitess,代码行数:31,代码来源:vertical_split.py
示例17: tearDownModule
def tearDownModule():
utils.required_teardown()
if utils.options.skip_teardown:
return
if use_mysqlctld:
# Try to terminate mysqlctld gracefully, so it kills its mysqld.
for proc in setup_procs:
utils.kill_sub_process(proc, soft=True)
teardown_procs = setup_procs
else:
teardown_procs = [
tablet_master.teardown_mysql(),
tablet_replica1.teardown_mysql(),
tablet_replica2.teardown_mysql(),
]
utils.wait_procs(teardown_procs, raise_on_error=False)
environment.topo_server().teardown()
utils.kill_sub_processes()
utils.remove_tmp_files()
tablet_master.remove_tree()
tablet_replica1.remove_tree()
tablet_replica2.remove_tree()
开发者ID:dumbunny,项目名称:vitess,代码行数:25,代码来源:backup.py
示例18: setUp
def setUp(self):
utils.wait_procs([self.tablet.init_mysql()])
self.tablet.mquery(
'', ['create database vt_test_keyspace', 'set global read_only = off'])
self.mysql_conn, mcu = self.tablet.connect('vt_test_keyspace')
with open(
os.path.join(self.vttop, 'test', 'test_data', 'test_schema.sql')) as f:
self.clean_sqls = []
self.init_sqls = []
clean_mode = False
for line in f:
line = line.rstrip()
if line == '# clean':
clean_mode = True
if line=='' or line.startswith('#'):
continue
if clean_mode:
self.clean_sqls.append(line)
else:
self.init_sqls.append(line)
try:
for line in self.init_sqls:
mcu.execute(line, {})
finally:
mcu.close()
customrules = os.path.join(environment.tmproot, 'customrules.json')
schema_override = os.path.join(environment.tmproot, 'schema_override.json')
self.create_schema_override(schema_override)
table_acl_config = os.path.join(
environment.vttop, 'test', 'test_data', 'table_acl_config.json')
environment.topo_server().setup()
self.create_customrules(customrules);
utils.run_vtctl('CreateKeyspace -force test_keyspace')
self.tablet.init_tablet('master', 'test_keyspace', '0')
if environment.topo_server().flavor() == 'zookeeper':
self.tablet.start_vttablet(
memcache=self.memcache,
zkcustomrules='/zk/test_ca/config/customrules/testrules',
schema_override=schema_override,
table_acl_config=table_acl_config,
)
else:
self.tablet.start_vttablet(
memcache=self.memcache,
filecustomrules=customrules,
schema_override=schema_override,
table_acl_config=table_acl_config,
)
self.conn = self.connect()
self.txlogger = utils.curl(
self.url('/debug/txlog'), background=True,
stdout=open(self.txlog_file, 'w'))
self.txlog = framework.Tailer(self.txlog_file, flush=self.tablet.flush)
self.log = framework.Tailer(
os.path.join(environment.vtlogroot, 'vttablet.INFO'),
flush=self.tablet.flush)
self.querylog = Querylog(self)
开发者ID:zhaoyta,项目名称:vitess,代码行数:60,代码来源:test_env.py
示例19: set_up
def set_up(self):
try:
environment.topo_server().setup()
utils.wait_procs([t.init_mysql() for t in self.tablets])
utils.run_vtctl(['CreateKeyspace', self.keyspace])
utils.run_vtctl(['SetKeyspaceShardingInfo', '-force', self.keyspace, 'keyspace_id', 'uint64'])
for t in self.tablets:
t.init_tablet(t.type, keyspace=self.keyspace, shard=t.shard)
utils.run_vtctl(['RebuildKeyspaceGraph', self.keyspace], auto_log=True)
for t in self.tablets:
t.create_db('vt_' + self.keyspace)
t.start_vttablet(
wait_for_state=None,
extra_args=['-queryserver-config-schema-reload-time', '1'],
)
for t in self.tablets:
t.wait_for_vttablet_state('SERVING')
for t in self.tablets:
if t.type == "master":
utils.run_vtctl(['ReparentShard', '-force', self.keyspace+'/'+t.shard, t.tablet_alias], auto_log=True)
utils.run_vtctl(['RebuildKeyspaceGraph', self.keyspace], auto_log=True)
if self.schema:
utils.run_vtctl(['ApplySchemaKeyspace', '-simple', '-sql', self.schema, self.keyspace])
if self.vschema:
if self.vschema[0] == '{':
utils.run_vtctl(['ApplyVSchema', "-vschema", self.vschema])
else:
utils.run_vtctl(['ApplyVSchema', "-vschema_file", self.vschema])
self.vtgate_server, self.vtgate_port = utils.vtgate_start(cache_ttl='500s', vtport=self.vtgate_port)
vtgate_client = zkocc.ZkOccConnection("localhost:%u" % self.vtgate_port, "test_nj", 30.0)
topology.read_topology(vtgate_client)
except:
self.shutdown()
raise
开发者ID:chengc017,项目名称:vitess,代码行数:34,代码来源:java_vtgate_test_helper.py
示例20: launch
def launch(
self, keyspace, shards=None, replica_count=1, rdonly_count=0, ddls=None):
"""Launch test environment."""
if replica_count < 1:
raise Exception('replica_count=%d < 1; tests now use semi-sync'
' and must have at least one replica' % replica_count)
self.tablets = []
self.master_tablets = []
utils.run_vtctl(['CreateKeyspace', keyspace])
if not shards or shards[0] == '0':
shards = ['0']
# Create tablets and start mysqld.
procs = []
for shard in shards:
procs.append(self._new_tablet(keyspace, shard, 'master', None))
for i in xrange(replica_count):
procs.append(self._new_tablet(keyspace, shard, 'replica', i))
for i in xrange(rdonly_count):
procs.append(self._new_tablet(keyspace, shard, 'rdonly', i))
utils.wait_procs(procs)
# init tablets.
for shard in shards:
tablet_index = 0
self._init_tablet(keyspace, shard, 'master', None, tablet_index)
tablet_index += 1
for i in xrange(replica_count):
self._init_tablet(keyspace, shard, 'replica', i, tablet_index)
tablet_index += 1
for i in xrange(rdonly_count):
self._init_tablet(keyspace, shard, 'rdonly', i, tablet_index)
tablet_index += 1
# Start tablets.
for shard in shards:
self._start_tablet(keyspace, shard, 'master', None)
for i in xrange(replica_count):
self._start_tablet(keyspace, shard, 'replica', i)
for i in xrange(rdonly_count):
self._start_tablet(keyspace, shard, 'rdonly', i)
for t in self.tablets:
t.wait_for_vttablet_state('NOT_SERVING')
for t in self.master_tablets:
utils.run_vtctl(['InitShardMaster', '-force', keyspace+'/'+t.shard,
t.tablet_alias], auto_log=True)
t.tablet_type = 'master'
for t in self.tablets:
t.wait_for_vttablet_state('SERVING')
for ddl in ddls:
fname = os.path.join(environment.tmproot, 'ddl.sql')
with open(fname, 'w') as f:
f.write(ddl)
utils.run_vtctl(['ApplySchema', '-sql-file', fname, keyspace])
开发者ID:dumbunny,项目名称:vitess,代码行数:59,代码来源:keyspace_util.py
注:本文中的utils.wait_procs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论