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


Python vtctl_client.connect函数代码示例

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


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

示例1: start

  def start(self):
    args = environment.binary_args('vtctld') + [
            '-debug',
            '-templates', environment.vttop + '/go/cmd/vtctld/templates',
            '-log_dir', environment.vtlogroot,
            '-port', str(self.port),
            ] + \
            environment.topo_server_flags() + \
            environment.tablet_manager_protocol_flags()
    stderr_fd = open(os.path.join(environment.tmproot, "vtctld.stderr"), "w")
    self.proc = run_bg(args, stderr=stderr_fd)

    # wait for the process to listen to RPC
    timeout = 30
    while True:
      v = get_vars(self.port)
      if v:
        break
      timeout = wait_step('waiting for vtctld to start', timeout,
                          sleep_time=0.2)

    # save the running instance so vtctl commands can be remote executed now
    global vtctld, vtctld_connection
    if not vtctld:
      vtctld = self
      vtctld_connection = vtctl_client.connect(
          environment.vtctl_client_protocol(), 'localhost:%u' % self.port, 30)

    return self.proc
开发者ID:Mistobaan,项目名称:vitess,代码行数:29,代码来源:utils.py

示例2: start

  def start(self, enable_schema_change_dir=False):
    # Note the vtctld2 web dir is set to 'dist', which is populated
    # when a toplevel 'make build_web' is run. This is meant to test
    # the development version of the UI. The real checked-in app is in
    # app/.
    args = environment.binary_args('vtctld') + [
        '-enable_queries',
        '-cell', 'test_nj',
        '-web_dir', environment.vttop + '/web/vtctld',
        '-web_dir2', environment.vttop + '/web/vtctld2/dist',
        '--log_dir', environment.vtlogroot,
        '--port', str(self.port),
        '-tablet_manager_protocol',
        protocols_flavor().tablet_manager_protocol(),
        '-tablet_protocol', protocols_flavor().tabletconn_protocol(),
        '-throttler_client_protocol',
        protocols_flavor().throttler_client_protocol(),
        '-vtgate_protocol', protocols_flavor().vtgate_protocol(),
        '-workflow_manager_init',
        '-workflow_manager_use_election',
    ] + environment.topo_server().flags()
    # TODO(b/26388813): Remove the next two lines once vtctl WaitForDrain is
    #                   integrated in the vtctl MigrateServed* commands.
    args.extend(['--wait_for_drain_sleep_rdonly', '0s'])
    args.extend(['--wait_for_drain_sleep_replica', '0s'])
    if enable_schema_change_dir:
      args += [
          '--schema_change_dir', self.schema_change_dir,
          '--schema_change_controller', 'local',
          '--schema_change_check_interval', '1',
      ]
    if protocols_flavor().service_map():
      args.extend(['-service_map', ','.join(protocols_flavor().service_map())])
    if protocols_flavor().vtctl_client_protocol() == 'grpc':
      args.extend(['-grpc_port', str(self.grpc_port)])
    stdout_fd = open(os.path.join(environment.tmproot, 'vtctld.stdout'), 'w')
    stderr_fd = open(os.path.join(environment.tmproot, 'vtctld.stderr'), 'w')
    self.proc = run_bg(args, stdout=stdout_fd, stderr=stderr_fd)

    # wait for the process to listen to RPC
    timeout = 30
    while True:
      v = get_vars(self.port)
      if v:
        break
      if self.proc.poll() is not None:
        raise TestError('vtctld died while starting')
      timeout = wait_step('waiting for vtctld to start', timeout,
                          sleep_time=0.2)

    # save the running instance so vtctl commands can be remote executed now
    global vtctld, vtctld_connection
    if not vtctld:
      vtctld = self
      protocol, endpoint = self.rpc_endpoint(python=True)
      vtctld_connection = vtctl_client.connect(protocol, endpoint, 30)

    return self.proc
开发者ID:mapbased,项目名称:vitess,代码行数:58,代码来源:utils.py

示例3: test_interrupt_vtctl_command

 def test_interrupt_vtctl_command(self):
   """An interrupted streaming vtctl command should work."""
   protocol, endpoint = utils.vtctld.rpc_endpoint(python=True)
   vtctld_connection = vtctl_client.connect(protocol, endpoint, 30)
   for i, event in enumerate(
       vtctld_connection.execute_vtctl_command(['ListAllTablets', 'test_nj'])):
     logging.debug('got event %d %s', i, event.value)
     if i == 1:
       break
   vtctld_connection.close()
开发者ID:c3p0hz,项目名称:vitess,代码行数:10,代码来源:vtctld_test.py

示例4: start

    def start(self):
        args = (
            environment.binary_args("vtctld")
            + [
                "-debug",
                "-web_dir",
                environment.vttop + "/web/vtctld",
                "--log_dir",
                environment.vtlogroot,
                "--port",
                str(self.port),
                "--schema_change_dir",
                self.schema_change_dir,
                "--schema_change_controller",
                "local",
                "--schema_change_check_interval",
                "1",
                "-tablet_manager_protocol",
                protocols_flavor().tablet_manager_protocol(),
                "-vtgate_protocol",
                protocols_flavor().vtgate_protocol(),
                "-tablet_protocol",
                protocols_flavor().tabletconn_protocol(),
            ]
            + environment.topo_server().flags()
        )
        if protocols_flavor().service_map():
            args.extend(["-service_map", ",".join(protocols_flavor().service_map())])
        if protocols_flavor().vtctl_client_protocol() == "grpc":
            args.extend(["-grpc_port", str(self.grpc_port)])
        stdout_fd = open(os.path.join(environment.tmproot, "vtctld.stdout"), "w")
        stderr_fd = open(os.path.join(environment.tmproot, "vtctld.stderr"), "w")
        self.proc = run_bg(args, stdout=stdout_fd, stderr=stderr_fd)

        # wait for the process to listen to RPC
        timeout = 30
        while True:
            v = get_vars(self.port)
            if v:
                break
            if self.proc.poll() is not None:
                raise TestError("vtctld died while starting")
            timeout = wait_step("waiting for vtctld to start", timeout, sleep_time=0.2)

        # save the running instance so vtctl commands can be remote executed now
        global vtctld, vtctld_connection
        if not vtctld:
            vtctld = self
            protocol, endpoint = self.rpc_endpoint(python=True)
            vtctld_connection = vtctl_client.connect(protocol, endpoint, 30)

        return self.proc
开发者ID:tjyang,项目名称:vitess,代码行数:52,代码来源:utils.py

示例5: start

  def start(self, enable_schema_change_dir=False):
    args = environment.binary_args('vtctld') + [
        '-enable_queries',
        '-cell', 'test_nj',
        '-web_dir', environment.vttop + '/web/vtctld',
        '--log_dir', environment.vtlogroot,
        '--port', str(self.port),
        '-tablet_manager_protocol',
        protocols_flavor().tablet_manager_protocol(),
        '-tablet_protocol', protocols_flavor().tabletconn_protocol(),
        '-throttler_client_protocol',
        protocols_flavor().throttler_client_protocol(),
        '-vtgate_protocol', protocols_flavor().vtgate_protocol(),
    ] + environment.topo_server().flags()
    if enable_schema_change_dir:
      args += [
          '--schema_change_dir', self.schema_change_dir,
          '--schema_change_controller', 'local',
          '--schema_change_check_interval', '1',
      ]
    if protocols_flavor().service_map():
      args.extend(['-service_map', ','.join(protocols_flavor().service_map())])
    if protocols_flavor().vtctl_client_protocol() == 'grpc':
      args.extend(['-grpc_port', str(self.grpc_port)])
    stdout_fd = open(os.path.join(environment.tmproot, 'vtctld.stdout'), 'w')
    stderr_fd = open(os.path.join(environment.tmproot, 'vtctld.stderr'), 'w')
    self.proc = run_bg(args, stdout=stdout_fd, stderr=stderr_fd)

    # wait for the process to listen to RPC
    timeout = 30
    while True:
      v = get_vars(self.port)
      if v:
        break
      if self.proc.poll() is not None:
        raise TestError('vtctld died while starting')
      timeout = wait_step('waiting for vtctld to start', timeout,
                          sleep_time=0.2)

    # save the running instance so vtctl commands can be remote executed now
    global vtctld, vtctld_connection
    if not vtctld:
      vtctld = self
      protocol, endpoint = self.rpc_endpoint(python=True)
      vtctld_connection = vtctl_client.connect(protocol, endpoint, 30)

    return self.proc
开发者ID:mattharden,项目名称:vitess,代码行数:47,代码来源:utils.py

示例6: start

  def start(self):
    args = environment.binary_args('vtctld') + [
            '-debug',
            '--templates', environment.vttop + '/go/cmd/vtctld/templates',
            '--log_dir', environment.vtlogroot,
            '--port', str(self.port),
            '--schema_change_dir', self.schema_change_dir,
            '--schema_change_controller', 'local',
            '--schema_change_check_interval', '1',
            '-tablet_manager_protocol',
            protocols_flavor().tablet_manager_protocol(),
            ] + \
            environment.topo_server().flags() + \
            protocols_flavor().vtgate_protocol_flags()
    if protocols_flavor().service_map():
      args.extend(['-service_map', ",".join(protocols_flavor().service_map())])
    if protocols_flavor().vtctl_client_protocol() == 'grpc':
      args.extend(['-grpc_port', str(self.grpc_port)])
    stderr_fd = open(os.path.join(environment.tmproot, 'vtctld.stderr'), 'w')
    self.proc = run_bg(args, stderr=stderr_fd)

    # wait for the process to listen to RPC
    timeout = 30
    while True:
      v = get_vars(self.port)
      if v:
        break
      timeout = wait_step('waiting for vtctld to start', timeout,
                          sleep_time=0.2)

    # save the running instance so vtctl commands can be remote executed now
    protocol = protocols_flavor().vtctl_client_protocol()
    if protocol == "grpc":
      # import the grpc vtctl client implementation, disabled for now:
      # from vtctl import grpc_vtctl_client
      # temporary protocol override until python client support works
      protocol = "gorpc"
    global vtctld, vtctld_connection
    if not vtctld:
      vtctld = self
      vtctld_connection = vtctl_client.connect(
          protocol, 'localhost:%u' % self.port, 30)

    return self.proc
开发者ID:forks-badal,项目名称:vitess,代码行数:44,代码来源:utils.py

示例7: start

  def start(self):
    args = environment.binary_args('vtctld') + [
            '-debug',
            '-templates', environment.vttop + '/go/cmd/vtctld/templates',
            '-log_dir', environment.vtlogroot,
            '-port', str(self.port),
            ] + \
            environment.topo_server().flags() + \
            protocols_flavor().tablet_manager_protocol_flags()
    if protocols_flavor().vtctl_client_protocol() == "grpc":
      args += ['-grpc_port', str(self.grpc_port),
              '-service_map', 'grpc-vtctl']
    stderr_fd = open(os.path.join(environment.tmproot, "vtctld.stderr"), "w")
    self.proc = run_bg(args, stderr=stderr_fd)

    # wait for the process to listen to RPC
    timeout = 30
    while True:
      v = get_vars(self.port)
      if v:
        break
      timeout = wait_step('waiting for vtctld to start', timeout,
                          sleep_time=0.2)

    # save the running instance so vtctl commands can be remote executed now
    protocol = protocols_flavor().vtctl_client_protocol()
    # temporary protocol override until python client support works
    if protocol == "grpc":
      protocol = "gorpc"
    global vtctld, vtctld_connection
    if not vtctld:
      vtctld = self
      vtctld_connection = vtctl_client.connect(
          protocol, 'localhost:%u' % self.port, 30)

    return self.proc
开发者ID:Eter365,项目名称:vitess,代码行数:36,代码来源:utils.py

示例8: __init__

 def __init__(self, protocol, vtctl_addr):
   self.protocol = protocol
   self.client = None
   self.vtctl_addr = vtctl_addr
   if vtctl_addr and protocol != 'grpc':
     self.client = vtctl_client.connect(protocol, vtctl_addr, 30)
开发者ID:alainjobart,项目名称:vitess,代码行数:6,代码来源:vtctl_helper.py


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