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


Python scenario_common.parse_mode_flags函数代码示例

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


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

示例1: OptParser

# Copyright 2010-2012 RethinkDB, all rights reserved.
import sys, os, time
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import http_admin, driver, workload_runner, scenario_common
from vcoptparse import *

op = OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
op["workload1"] = PositionalArg()
op["workload2"] = PositionalArg()
op["timeout"] = IntFlag("--timeout", 600)
opts = op.parse(sys.argv)

with driver.Metacluster() as metacluster:
    cluster = driver.Cluster(metacluster)
    executable_path, command_prefix, serve_options = scenario_common.parse_mode_flags(opts)

    print "Starting cluster..."
    files1 = driver.Files(metacluster, db_path = "db-first", log_path = "create-output-first",
                          executable_path = executable_path, command_prefix = command_prefix)
    process1 = driver.Process(cluster, files1, log_path = "serve-output-first",
        executable_path = executable_path, command_prefix = command_prefix, extra_options = serve_options)
    process1.wait_until_started_up()

    print "Creating namespace..."
    http1 = http_admin.ClusterAccess([("localhost", process1.http_port)])
    dc = http1.add_datacenter()
    http1.move_server_to_datacenter(files1.machine_name, dc)
    ns = scenario_common.prepare_table_for_workload(opts, http1, primary = dc)
    http1.wait_until_blueprint_satisfied(ns)
开发者ID:AVGP,项目名称:rethinkdb,代码行数:30,代码来源:transfer.py

示例2: ValueError

                    workingValue -= 1
                elif char == '+':
                    workingValue += 1
                else:
                    raise ValueError('Got a bad step value: %s' % repr(char))
                assert char in ('-', '+')
            returnValue += (workingValue,)
    return returnValue

op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
workload_runner.prepare_option_parser_for_split_or_continuous_workload(op, allow_between = True)
op["num-nodes"] = vcoptparse.IntFlag("--num-nodes", 3)
op["sequence"] = vcoptparse.ValueFlag("--sequence", converter=sequence_from_string, default=(2, 3))
opts = op.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(opts)

class Rebalance(rdb_unittest.RdbTestCase):
    '''Change the number of shards on a table.'''
    # keep the same number of replicas as nodes so we don't have to backfill constantly
    
    replicas = opts["num-nodes"]
    shards = 1
    
    server_command_prefix = command_prefix
    server_extra_options = serve_options
    
    def test_workload(self):
        
        connServer = self.cluster[0]
        
开发者ID:AtnNn,项目名称:rethinkdb,代码行数:30,代码来源:rebalance.py

示例3:

#!/usr/bin/env python
# Copyright 2015-2016 RethinkDB, all rights reserved.

import os, sys, time

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
_, command_prefix, server_options = scenario_common.parse_mode_flags(op.parse(sys.argv))

r = utils.import_python_driver()

with driver.Cluster(initial_servers=["a", "b"], output_folder='.', command_prefix=command_prefix, extra_options=server_options) as cluster:

    utils.print_with_time("Establishing ReQl connections")
    conn = r.connect(host=cluster[0].host, port=cluster[0].driver_port)

    utils.print_with_time("Creating a table")
    r.db_create("test").run(conn)
    res = r.table_create("test", replicas=2).run(conn)
    table_uuid = res["config_changes"][0]["new_val"]["id"]
    
    r.table("test").wait(wait_for="all_replicas_ready").run(conn)
    r.table("test").insert(r.range(1000).map({"value": r.row})).run(conn)
    
    assert os.path.exists(os.path.join(cluster[0].data_path, table_uuid))
    assert os.path.exists(os.path.join(cluster[1].data_path, table_uuid))

    utils.print_with_time("Removing one replica")
开发者ID:AtnNn,项目名称:rethinkdb,代码行数:31,代码来源:issue_4440.py


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