本文整理汇总了Python中lib.tarantool_server.TarantoolServer.deploy方法的典型用法代码示例。如果您正苦于以下问题:Python TarantoolServer.deploy方法的具体用法?Python TarantoolServer.deploy怎么用?Python TarantoolServer.deploy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.tarantool_server.TarantoolServer
的用法示例。
在下文中一共展示了TarantoolServer.deploy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
server.deploy()
print '-------------------------------------------------------------'
print 'Start a new replica and check box.info on the start'
print '-------------------------------------------------------------'
# master server
master = server
master_id = master.get_param('server')['id']
master.admin("box.schema.user.grant('guest', 'replication')")
replica = TarantoolServer(server.ini)
replica.script = 'replication/replica.lua'
replica.vardir = server.vardir
replica.rpl_master = master
replica.deploy()
replica.wait_lsn(master_id, master.get_lsn(master_id))
replica_id = replica.get_param('server')['id']
replica_uuid = replica.get_param('server')['uuid']
sys.stdout.push_filter(replica_uuid, '<replica uuid>')
replica.admin('box.info.server.id == %d' % replica_id)
replica.admin('not box.info.server.ro')
replica.admin('box.info.server.lsn == 0')
replica.admin('box.info.vclock[%d] == 0' % replica_id)
print '-------------------------------------------------------------'
print 'Modify data to change LSN and check box.info'
print '-------------------------------------------------------------'
replica.admin('box.space._schema:insert{"test", 48}')
replica.admin('box.info.server.lsn == 1')
示例2: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
import os
from glob import iglob as glob
from lib.tarantool_server import TarantoolServer
# master server
master = server
master_id = master.get_param('server')['id']
master.admin("box.schema.user.grant('guest', 'replication')")
replica = TarantoolServer(server.ini)
replica.script = 'replication/replica.lua'
replica.vardir = server.vardir #os.path.join(server.vardir, 'replica')
replica.rpl_master = master
replica.deploy()
replica.wait_lsn(master_id, master.get_lsn(master_id))
replica_id = replica.get_param('server')['id']
replica.admin('box.info.server.id')
replica.admin('box.info.server.ro')
replica.admin('box.info.server.lsn')
replica.stop()
print '-------------------------------------------------------------'
print 'replica is read-only until receive self server_id in _cluster'
print '-------------------------------------------------------------'
# Remove xlog retrived by SUBSCRIBE
filename = str(0).zfill(20) + ".xlog"
wal = os.path.join(os.path.join(replica.vardir, replica.name), filename)
os.remove(wal)
示例3: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
# encoding: utf-8
import os
import time
from lib.tarantool_server import TarantoolServer
# master server
master = server
master_sql = master.sql
# hot standby server
hot_standby = TarantoolServer()
hot_standby.deploy("replication/cfg/hot_standby.cfg",
hot_standby.find_exe(self.args.builddir),
os.path.join(self.args.vardir, "hot_standby"), need_init=False)
hot_standby_sql = hot_standby.sql
# replica server
replica = TarantoolServer()
replica.deploy("replication/cfg/replica.cfg",
replica.find_exe(self.args.builddir),
os.path.join(self.args.vardir, "replica"))
replica_sql = replica.sql
# Begin tuple id
id = 1
print """
# Insert 10 tuples to master
"""
for i in range(id, id + 10):
示例4: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
import yaml
from lib.memcached_connection import MemcachedConnection
from lib.tarantool_server import TarantoolServer
sonet = """The expense of spirit
in a waste of shame
Is lust in action;
and till action, lust""".split('\n')
master = server
master_memcached = master.memcached
replica = TarantoolServer()
replica.deploy("replication/cfg/replica.cfg",
replica.find_exe(self.args.builddir),
os.path.join(self.args.vardir, "replica"))
replica_memcached = replica.memcached
###################################
def get_lsn(serv):
serv_admin = serv.admin
resp = serv_admin("box.info.lsn", silent=True)
return yaml.load(resp)[0]
def wait(serv_master = master, serv_replica = replica):
lsn = get_lsn(serv_master)
serv_replica.wait_lsn(lsn)
return lsn
def get_memcached_len(serv):
示例5: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
import os
import sys
import re
import yaml
from lib.tarantool_server import TarantoolServer
server = TarantoolServer(server.ini)
server.script = 'long_run/lua/finalizers.lua'
server.vardir = os.path.join(server.vardir, 'finalizers')
try:
server.deploy()
except:
print "Expected error:", sys.exc_info()[0]
else:
print "Error! exception did not occur"
示例6: TarantoolServer
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
replica = TarantoolServer(server.ini)
replica.script = 'replication-py/replica.lua'
replica.vardir = server.vardir #os.path.join(server.vardir, 'replica')
replica.rpl_master = master
# #1075: Box.once should wait before the server enters RW mode
#
# We expect the replica to get blocked in box.cfg{}, hence wait = False.
# Since xlog files on master were deleted, they aren't delivered,
# and replica waits indefinitely.
#
# Note: replica waits for a log entry indicating that this very replica
# joined the cluster. Once the entry is fetched we assume that the
# replica is relatively up to date and enter RW mode. Never happens in
# this particular test case.
replica.deploy(wait = False)
replica.admin('box.space.test')
replica.admin('box_cfg_done') # blocked in box.cfg it should be
replica.stop()
replica.cleanup(True)
print '-------------------------------------------------------------'
print 'replica JOIN'
print '-------------------------------------------------------------'
master.admin('box.snapshot()')
master.restart()
示例7: Supervisor
# 需要导入模块: from lib.tarantool_server import TarantoolServer [as 别名]
# 或者: from lib.tarantool_server.TarantoolServer import deploy [as 别名]
class Supervisor(object):
def __init__(self, suite_path, args):
self.args = args
self.tests = []
self.suite_path = suite_path
self.ini = {
'core': 'tarantool',
'script': os.path.join(suite_path, 'parallel.lua'),
}
# read suite config
config = ConfigParser.ConfigParser()
config.read(os.path.join(suite_path, "suite.ini"))
self.ini.update(dict(config.items("default")))
self.ini.update(self.args.__dict__)
self.jobs = int(self.ini.get('jobs', 1))
self.count = int(self.ini.get('count', 0))
for i in ["script"]:
self.ini[i] = os.path.join(suite_path, self.ini[i]) if i in self.ini else None
self.server = TarantoolServer(self.ini)
self.pool = None
self.iterator = None
def find_tests(self):
self.tests += [Parallel_PythonTest(k) \
for k in sorted(glob.glob(os.path.join(self.suite_path, "*.test.py" )))]
def take_rand(self):
if self.count != 0:
for test in self.tests:
sql = self.server.sql.clone()
admin = self.server.admin.clone()
yield [test, [sql, admin]]
else:
while True:
sql = self.server.sql.clone()
admin = self.server.admin.clone()
yield [random.choice(self.tests), [sql, admin]]
def run_all(self):
self.find_tests()
if self.count != 0:
self.tests *= self.count
random.shuffle(self.tests)
self.pool = GopherPool(processes = self.jobs)
self.iterator = self.pool.run()
self.filler = self.pool.fill(self.take_rand())
try:
self.server.cleanup()
logger.info("Tarantool.Instance > Server cleaned up")
logger.info("Tarantool.Instance > Server's path: %s", self.server.binary)
self.server.deploy()
logger.info("Tarantool.Instance > Server deployed")
try:
while True:
self.filler.next()
logger.debug("BigBrother.run > Jobs filled %d %d" %
(self.pool.queuein.qsize(), self.pool.queueout.qsize()))
while True:
try:
logger.debug("BigBrother.run > waiting for task")
task = self.iterator.next(1)
logger.debug("BigBrother.run > took task")
if task is None:
logger.info('>>>> Test return NONE')
continue
stat = task.get_status()
if stat.status != 3:
logger.info('>>>> Test %s finished' % repr(task.name))
else:
logger.error('>>>> Test %s failed with %s (%s)' %
(repr(task.name), stat.message, stat.reject))
except (QueueEmpty, StopIteration):
break
except StopIteration:
pass
finally:
self.server.stop()
logger.info("Tarantool.Instance > Server stopped")