Пример #1
0
  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
Пример #2
0
    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
Пример #3
0
  def vtctl_client(self, args):
    if options.verbose == 2:
      log_level='INFO'
    elif options.verbose == 1:
      log_level='WARNING'
    else:
      log_level='ERROR'

    out, err = run(environment.binary_args('vtctlclient') +
                   ['-vtctl_client_protocol',
                    environment.vtctl_client_protocol(),
                    '-server', 'localhost:%u' % self.port,
                    '-stderrthreshold', log_level] + args,
                   trap_output=True)
    return out
Пример #4
0
    def vtctl_client(self, args):
        if options.verbose == 2:
            log_level = 'INFO'
        elif options.verbose == 1:
            log_level = 'WARNING'
        else:
            log_level = 'ERROR'

        out, err = run(environment.binary_args('vtctlclient') + [
            '-vtctl_client_protocol',
            environment.vtctl_client_protocol(), '-server',
            'localhost:%u' % self.port, '-stderrthreshold', log_level
        ] + args,
                       trap_output=True)
        return out