***

layout: overview
slug: nemo-curator/nemo\_curator/core/client
title: nemo\_curator.core.client
--------------------------------

## Module Contents

### Classes

| Name                                               | Description                                                                    |
| -------------------------------------------------- | ------------------------------------------------------------------------------ |
| [`RayClient`](#nemo_curator-core-client-RayClient) | This class is used to setup the Ray cluster and configure metrics integration. |

### API

<Anchor id="nemo_curator-core-client-RayClient">
  <CodeBlock showLineNumbers={false} wordWrap={true}>
    ```python
    class nemo_curator.core.client.RayClient(
        ray_port: int = DEFAULT_RAY_PORT,
        ray_dashboard_port: int = DEFAULT_RAY_DASHBOARD_PORT,
        ray_client_server_port: int = DEFAULT_RAY_CLIENT_SERVER_PORT,
        ray_temp_dir: str = DEFAULT_RAY_TEMP_DIR,
        include_dashboard: bool = True,
        ray_metrics_port: int = DEFAULT_RAY_METRICS_PORT,
        ray_dashboard_host: str = DEFAULT_RAY_DASHBOARD_HOST,
        num_gpus: int | None = None,
        num_cpus: int | None = None,
        object_store_memory: int | None = None,
        enable_object_spilling: bool = False,
        ray_stdouterr_capture_file: str | None = None,
        metrics_dir: str | None = None
    )
    ```
  </CodeBlock>
</Anchor>

<Indent>
  <Badge>
    Dataclass
  </Badge>

  This class is used to setup the Ray cluster and configure metrics integration.

  If the specified ports are already in use, it will find the next available port and use that.

  **Parameters:**

  <ParamField path="ray_port" type="int" default="DEFAULT_RAY_PORT">
    The port number of the Ray GCS.
  </ParamField>

  <ParamField path="ray_dashboard_port" type="int" default="DEFAULT_RAY_DASHBOARD_PORT">
    The port number of the Ray dashboard.
  </ParamField>

  <ParamField path="ray_temp_dir" type="str" default="DEFAULT_RAY_TEMP_DIR">
    The temporary directory to use for Ray.
  </ParamField>

  <ParamField path="include_dashboard" type="bool" default="True">
    Whether to include dashboard integration. If true, adds Ray metrics service discovery.
  </ParamField>

  <ParamField path="ray_metrics_port" type="int" default="DEFAULT_RAY_METRICS_PORT">
    The port number of the Ray metrics.
  </ParamField>

  <ParamField path="ray_dashboard_host" type="str" default="DEFAULT_RAY_DASHBOARD_HOST">
    The host of the Ray dashboard.
  </ParamField>

  <ParamField path="num_gpus" type="int | None" default="None">
    The number of GPUs to use.
  </ParamField>

  <ParamField path="num_cpus" type="int | None" default="None">
    The number of CPUs to use.
  </ParamField>

  <ParamField path="object_store_memory" type="int | None" default="None">
    The amount of memory to use for the object store.
  </ParamField>

  <ParamField path="enable_object_spilling" type="bool" default="False">
    Whether to enable object spilling.
  </ParamField>

  <ParamField path="ray_stdouterr_capture_file" type="str | None" default="None">
    The file to capture stdout/stderr to.
  </ParamField>

  <ParamField path="metrics_dir" type="str | None" default="None">
    The directory for Prometheus/Grafana metrics data. If None, uses the per-user default.
  </ParamField>

  <ParamField path="enable_object_spilling" type="bool = False" />

  <ParamField path="include_dashboard" type="bool = True" />

  <ParamField path="metrics_dir" type="str | None = None" />

  <ParamField path="num_cpus" type="int | None = None" />

  <ParamField path="num_gpus" type="int | None = None" />

  <ParamField path="object_store_memory" type="int | None = None" />

  <ParamField path="ray_client_server_port" type="int = DEFAULT_RAY_CLIENT_SERVER_PORT" />

  <ParamField path="ray_dashboard_host" type="str = DEFAULT_RAY_DASHBOARD_HOST" />

  <ParamField path="ray_dashboard_port" type="int = DEFAULT_RAY_DASHBOARD_PORT" />

  <ParamField path="ray_metrics_port" type="int = DEFAULT_RAY_METRICS_PORT" />

  <ParamField path="ray_port" type="int = DEFAULT_RAY_PORT" />

  <ParamField path="ray_process" type="Popen | None = field(init=False, default=None)" />

  <ParamField path="ray_stdouterr_capture_file" type="str | None = None" />

  <ParamField path="ray_temp_dir" type="str = DEFAULT_RAY_TEMP_DIR" />

  <Anchor id="nemo_curator-core-client-RayClient-__enter__">
    <CodeBlock showLineNumbers={false} wordWrap={true}>
      ```python
      nemo_curator.core.client.RayClient.__enter__()
      ```
    </CodeBlock>
  </Anchor>

  <Indent />

  <Anchor id="nemo_curator-core-client-RayClient-__exit__">
    <CodeBlock showLineNumbers={false} wordWrap={true}>
      ```python
      nemo_curator.core.client.RayClient.__exit__(
          exc = ()
      )
      ```
    </CodeBlock>
  </Anchor>

  <Indent />

  <Anchor id="nemo_curator-core-client-RayClient-__post_init__">
    <CodeBlock showLineNumbers={false} wordWrap={true}>
      ```python
      nemo_curator.core.client.RayClient.__post_init__() -> None
      ```
    </CodeBlock>
  </Anchor>

  <Indent />

  <Anchor id="nemo_curator-core-client-RayClient-start">
    <CodeBlock showLineNumbers={false} wordWrap={true}>
      ```python
      nemo_curator.core.client.RayClient.start() -> None
      ```
    </CodeBlock>
  </Anchor>

  <Indent>
    Start the Ray cluster if not already started, optionally capturing stdout/stderr to a file.
  </Indent>

  <Anchor id="nemo_curator-core-client-RayClient-stop">
    <CodeBlock showLineNumbers={false} wordWrap={true}>
      ```python
      nemo_curator.core.client.RayClient.stop() -> None
      ```
    </CodeBlock>
  </Anchor>

  <Indent />
</Indent>
