Beispiel #1
0
def main():
    parser = optparse.OptionParser(usage="usage: %prog [options]")
    parser.add_option(
        "--shards",
        action="store",
        type="string",
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option(
        "--tablet-config",
        action="store",
        type="string",
        help=
        "json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}"
    )
    parser.add_option("--keyspace", action="store", type="string")
    parser.add_option("--schema", action="store", type="string")
    parser.add_option("--vschema", action="store", type="string")
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
    env = TestEnv(options)
    if args[0] == 'setup':
        env.set_up()
        sys.stdout.write(json.dumps({
            "port": env.vtgate_port,
        }) + "\n")
        sys.stdout.flush()
    elif args[0] == 'teardown':
        env.shutdown()
Beispiel #2
0
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-m', '--memcache', action='store_true', default=False,
                    help='starts a memcache d, and tests rowcache')
  utils.add_options(parser)
  options, args = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
Beispiel #3
0
def main():
  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option("-m", "--memcache", action="store_true", default=False,
                    help="starts a memcache d, and tests rowcache")
  parser.add_option("-e", "--env", default='vttablet',
                    help="Environment that will be used. Valid options: vttablet, vtocc")
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
Beispiel #4
0
def main():
    parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
    parser.add_option('-m',
                      '--memcache',
                      action='store_true',
                      default=False,
                      help='starts a memcache d, and tests rowcache')
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-m', '--memcache', action='store_true', default=False,
                    help='starts a memcache d, and tests rowcache')
  parser.add_option(
      '-e', '--env', default='vttablet',
      help='Environment that will be used. Valid options: vttablet, vtocc')
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  run_tests(options, args)
def parse_args():
  global options, args
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  parser.add_option("--shards", action="store", type="string",
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option("--tablet-config", action="store", type="string",
                    help="json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}")
  parser.add_option("--keyspace", action="store", type="string")
  parser.add_option("--schema", action="store", type="string")
  parser.add_option("--vschema", action="store", type="string")
  parser.add_option("--vtgate-port", action="store", type="int")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
Beispiel #7
0
def main():
    parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
    parser.add_option(
        "-m", "--memcache", action="store_true", default=False, help="starts a memcache d, and tests rowcache"
    )
    parser.add_option(
        "-e", "--env", default="vttablet", help="Environment that will be used. Valid options: vttablet, vtocc"
    )
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
Beispiel #8
0
def main():
  parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
  parser.add_option('-e', '--environment_type', help='Environment type',
                    default=None)
  parser.add_option('-n', '--name', help='Environment name', default=None)
  parser.add_option('-p', '--environment_params',
                    help='Environment parameters if creating an environment '
                    'for the test', default=None)
  parser.add_option('-t', '--test_params', help='Test parameters',
                    default=None)
  utils.add_options(parser)
  global _options
  _options, _ = parser.parse_args()
  del sys.argv[1:]

  utils.main()
def parse_args():
  global options, args
  parser = optparse.OptionParser(usage='usage: %prog [options]')
  parser.add_option('--shards', action='store', type='string',
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option(
      '--tablet-config', action='store', type='string',
      help='json config for for non-master tablets. e.g '
      "{'replica':2, 'rdonly':1}")
  parser.add_option('--keyspace', action='store', type='string')
  parser.add_option('--dbname-override', action='store', type='string')
  parser.add_option('--schema', action='store', type='string')
  parser.add_option('--vschema', action='store', type='string')
  parser.add_option('--vtgate-port', action='store', type='int')
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
Beispiel #10
0
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()
    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)
        utils.VtGate().start(cache_ttl='500s')
        utils.Vtctld().start()
        print 'vtgate:', utils.vtgate.port
        print 'vtctld:', utils.vtctld.port
        utils.pause('the cluster is up, press enter to shut it down...')
    finally:
        env.teardown()
        utils.kill_sub_processes()
        utils.remove_tmp_files()
        environment.topo_server().teardown()
Beispiel #11
0
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()
  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)
    utils.VtGate().start(cache_ttl='500s')
    utils.Vtctld().start()
    print 'vtgate:', utils.vtgate.port
    print 'vtctld:', utils.vtctld.port
    utils.pause('the cluster is up, press enter to shut it down...')
  finally:
    env.teardown()
    utils.kill_sub_processes()
    utils.remove_tmp_files()
    environment.topo_server().teardown()
Beispiel #12
0
def main():
    parser = optparse.OptionParser(usage='usage: %prog [options] [test_names]')
    parser.add_option('-m',
                      '--memcache',
                      action='store_true',
                      default=False,
                      help='starts a memcache d, and tests rowcache')
    parser.add_option(
        '-e',
        '--env',
        default='vttablet',
        help='Environment that will be used. Valid options: vttablet, vtocc')
    utils.add_options(parser)
    options, args = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    run_tests(options, args)
def main():
  parser = optparse.OptionParser(usage="usage: %prog [options]")
  parser.add_option("--shards", action="store", type="string",
                    help="comma separated list of shard names, e.g: '-80,80-'")
  parser.add_option("--tablet-config", action="store", type="string",
                    help="json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}")
  parser.add_option("--keyspace", action="store", type="string")
  utils.add_options(parser)
  (options, args) = parser.parse_args()
  utils.set_options(options)
  env = TestEnv(options)
  if args[0] == 'setup':
    env.set_up()
    sys.stdout.write(json.dumps({
      "port": env.vtgate_port,
      }) + "\n")
    sys.stdout.flush()
  elif args[0] == 'teardown':
    env.shutdown()
Beispiel #14
0
def parse_args():
    global options, args
    parser = optparse.OptionParser(usage='usage: %prog [options]')
    parser.add_option(
        '--shards',
        action='store',
        type='string',
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option('--tablet-config',
                      action='store',
                      type='string',
                      help='json config for for non-master tablets. e.g '
                      "{'replica':2, 'rdonly':1}")
    parser.add_option('--keyspace', action='store', type='string')
    parser.add_option('--dbname-override', action='store', type='string')
    parser.add_option('--schema', action='store', type='string')
    parser.add_option('--vschema', action='store', type='string')
    parser.add_option('--vtgate-port', action='store', type='int')
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
Beispiel #15
0
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()
Beispiel #16
0
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()
def parse_args():
    global options, args
    parser = optparse.OptionParser(usage="usage: %prog [options]")
    parser.add_option(
        "--shards",
        action="store",
        type="string",
        help="comma separated list of shard names, e.g: '-80,80-'")
    parser.add_option(
        "--tablet-config",
        action="store",
        type="string",
        help=
        "json config for for non-master tablets. e.g {'replica':2, 'rdonly':1}"
    )
    parser.add_option("--keyspace", action="store", type="string")
    parser.add_option("--schema", action="store", type="string")
    parser.add_option("--vschema", action="store", type="string")
    parser.add_option("--vtgate-port", action="store", type="int")
    utils.add_options(parser)
    (options, args) = parser.parse_args()
    utils.set_options(options)
Beispiel #18
0
from protocols_flavor import set_protocols_flavor
from topo_flavor.server import set_topo_server_flavor

if __name__ == "__main__":
    parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
    parser.add_option("-m",
                      "--memcache",
                      action="store_true",
                      default=False,
                      help="starts a memcache d, and tests rowcache")
    parser.add_option(
        "-e",
        "--env",
        default='vttablet',
        help="Environment that will be used. Valid options: vttablet, vtocc")
    utils.add_options(parser)
    (options, args) = parser.parse_args()

    logging.getLogger().setLevel(logging.ERROR)
    utils.set_options(options)

    suite = unittest.TestSuite()
    if args:
        if args[0] == 'teardown':
            test_env.TestEnv(options.env).tearDown()
            exit(0)
        for arg in args:
            if hasattr(nocache_tests.TestNocache, arg):
                suite.addTest(nocache_tests.TestNocache(arg))
            elif hasattr(stream_tests.TestStream, arg):
                suite.addTest(stream_tests.TestStream(arg))
Beispiel #19
0
from queryservice_tests import stream_tests
from queryservice_tests import status_tests
from queryservice_tests import test_env

from mysql_flavor import set_mysql_flavor
from protocols_flavor import set_protocols_flavor
from topo_flavor.server import set_topo_server_flavor


if __name__ == "__main__":
  parser = optparse.OptionParser(usage="usage: %prog [options] [test_names]")
  parser.add_option("-m", "--memcache", action="store_true", default=False,
                    help="starts a memcache d, and tests rowcache")
  parser.add_option("-e", "--env", default='vttablet',
                    help="Environment that will be used. Valid options: vttablet, vtocc")
  utils.add_options(parser)
  (options, args) = parser.parse_args()

  logging.getLogger().setLevel(logging.ERROR)
  utils.set_options(options)

  suite = unittest.TestSuite()
  if args:
    if args[0] == 'teardown':
      test_env.TestEnv(options.env).tearDown()
      exit(0)
    for arg in args:
      if hasattr(nocache_tests.TestNocache, arg):
        suite.addTest(nocache_tests.TestNocache(arg))
      elif hasattr(stream_tests.TestStream, arg):
        suite.addTest(stream_tests.TestStream(arg))
Beispiel #20
0
import tqdm
from tensorboardX import SummaryWriter
from paddle import fluid
fluid.require_version('1.8.0')
import paddle.fluid.layers as F
import paddle.fluid.dygraph as dg
from parakeet.utils.io import load_parameters, save_parameters

from data import make_data_loader
from model import make_model, make_criterion, make_optimizer
from utils import make_output_tree, add_options, get_place, Evaluator, StateSaver, make_evaluator, make_state_saver

if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Train a Deep Voice 3 model with LJSpeech dataset.")
    add_options(parser)
    args, _ = parser.parse_known_args()

    # only use args.device when training in single process
    # when training with distributed.launch, devices are provided by
    # `--selected_gpus` for distributed.launch
    env = dg.parallel.ParallelEnv()
    device_id = env.dev_id if env.nranks > 1 else args.device
    place = get_place(device_id)
    # start dygraph
    dg.enable_dygraph(place)

    with open(args.config, 'rt') as f:
        config = ruamel.yaml.safe_load(f)

    print("Command Line Args: ")