class_docstr: Builder for a Ray Client connection. This class can be subclassed by
  custom builder classes to modify connection behavior to include additional
  features or altered semantics. One example is the ``_LocalClientBuilder``.
docstr: Begin a connection to the address passed in via ray.client(...).
  
  Returns:
      ClientInfo: Dataclass with information about the setting. This
          includes the server's version of Python & Ray as well as the
          dashboard_url.
docstr_tok: ["Begin","a","connection","to","the","address","passed","in","via","ray.client","(","...",")",".","Returns",":","ClientInfo",":","Dataclass","with","information","about","the","setting",".","This","includes","the","server","'s","version","of","Python","&","Ray","as","well","as","the","dashboard_url","."]
code: def connect(self) -> ClientContext:
      """
      Begin a connection to the address passed in via ray.client(...).
  
      Returns:
          ClientInfo: Dataclass with information about the setting. This
              includes the server's version of Python & Ray as well as the
              dashboard_url.
      """
      if self._deprecation_warn_enabled:
          self._client_deprecation_warn()
      # Fill runtime env/namespace from environment if not already set.
      # Should be done *after* the deprecation warning, since warning will
      # check if those values are already set.
      self._fill_defaults_from_env()
  
      # If it has already connected to the cluster with allow_multiple=True,
      # connect to the default one is not allowed.
      # But if it has connected to the default one, connect to other clients
      # with allow_multiple=True is allowed
      default_cli_connected = ray.util.client.ray.is_connected()
      has_cli_connected = ray.util.client.num_connected_contexts() > 0
      if (
          not self._allow_multiple_connections
          and not default_cli_connected
          and has_cli_connected
      ):
          raise ValueError(
              "The client has already connected to the cluster "
              "with allow_multiple=True. Please set allow_multiple=True"
              " to proceed"
          )
  
      old_ray_cxt = None
      if self._allow_multiple_connections:
          old_ray_cxt = ray.util.client.ray.set_context(None)
  
      client_info_dict = ray.util.client_connect.connect(
          self.address,
          job_config=self._job_config,
          _credentials=self._credentials,
          ray_init_kwargs=self._remote_init_kwargs,
          metadata=self._metadata,
      )
  
      dashboard_url = ray.util.client.ray._get_dashboard_url()
  
      cxt = ClientContext(
          dashboard_url=dashboard_url,
          python_version=client_info_dict["python_version"],
          ray_version=client_info_dict["ray_version"],
          ray_commit=client_info_dict["ray_commit"],
          protocol_version=client_info_dict["protocol_version"],
          _num_clients=client_info_dict["num_clients"],
          _context_to_restore=ray.util.client.ray.get_context(),
      )
      if self._allow_multiple_connections:
          ray.util.client.ray.set_context(old_ray_cxt)
      return cxt
  
imports: import importlib
  import inspect
  import json
  import logging
  import os
  import sys
  import warnings
  from dataclasses import dataclass
  from typing import Any, Dict, Optional, Tuple
  import ray.util.client_connect
  from ray._private.ray_constants import RAY_ADDRESS_ENVIRONMENT_VARIABLE, RAY_NAMESPACE_ENVIRONMENT_VARIABLE, RAY_RUNTIME_ENV_ENVIRONMENT_VARIABLE
  from ray._private.utils import check_ray_client_dependencies_installed, split_address
  from ray._private.worker import BaseContext
  from ray._private.worker import init
  from ray.job_config import JobConfig
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 4 for calling the ClientBuilder obj's underlying member method code with example usage: obj.connect() and returns: cxt