# flytekitplugins.ray.models

## Directory

### Classes

| Class | Description |
|-|-|
| [`AutoscalerOptions`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/page.md#flytekitpluginsraymodelsautoscaleroptions) |  |
| [`HeadGroupSpec`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/page.md#flytekitpluginsraymodelsheadgroupspec) |  |
| [`RayCluster`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/page.md#flytekitpluginsraymodelsraycluster) | Define RayCluster spec that will be used by KubeRay to launch the cluster. |
| [`RayJob`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/page.md#flytekitpluginsraymodelsrayjob) | Models _ray_pb2. |
| [`WorkerGroupSpec`](https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/page.md#flytekitpluginsraymodelsworkergroupspec) |  |

## flytekitplugins.ray.models.AutoscalerOptions

### Parameters

```python
class AutoscalerOptions(
    upscaling_mode: typing.Optional[ForwardRef('AutoscalerOptions.UpscalingMode')],
    idle_timeout_seconds: typing.Optional[int],
    image: typing.Optional[str],
    env: typing.Optional[typing.Dict[str, str]],
    resources: typing.Optional[flytekit.models.task.Resources],
)
```
| Parameter | Type | Description |
|-|-|-|
| `upscaling_mode` | `typing.Optional[ForwardRef('AutoscalerOptions.UpscalingMode')]` | |
| `idle_timeout_seconds` | `typing.Optional[int]` | |
| `image` | `typing.Optional[str]` | |
| `env` | `typing.Optional[typing.Dict[str, str]]` | |
| `resources` | `typing.Optional[flytekit.models.task.Resources]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `env` | `typing.Optional[typing.Dict[str, str]]` |  |
| `idle_timeout_seconds` | `typing.Optional[int]` |  |
| `image` | `typing.Optional[str]` |  |
| `is_empty` | `None` |  |
| `resources` | `typing.Optional[flytekit.models.task.Resources]` |  |
| `upscaling_mode` | `typing.Optional[ForwardRef('AutoscalerOptions.UpscalingMode')]` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    proto,
)
```
| Parameter | Type | Description |
|-|-|-|
| `proto` |  | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekitplugins.ray.models.HeadGroupSpec

### Parameters

```python
class HeadGroupSpec(
    ray_start_params: typing.Optional[typing.Dict[str, str]],
    k8s_pod: typing.Optional[flytekit.models.task.K8sPod],
)
```
| Parameter | Type | Description |
|-|-|-|
| `ray_start_params` | `typing.Optional[typing.Dict[str, str]]` | |
| `k8s_pod` | `typing.Optional[flytekit.models.task.K8sPod]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |
| `k8s_pod` | `None` | Additional pod specs for the head node pod. |
| `ray_start_params` | `None` | The ray start params of head node group. |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    proto,
)
```
| Parameter | Type | Description |
|-|-|-|
| `proto` |  | |

**Returns:** HeadGroupSpec

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.plugins._ray_pb2.HeadGroupSpec

## flytekitplugins.ray.models.RayCluster

Define RayCluster spec that will be used by KubeRay to launch the cluster.

### Parameters

```python
class RayCluster(
    worker_group_spec: typing.List[flytekitplugins.ray.models.WorkerGroupSpec],
    head_group_spec: typing.Optional[flytekitplugins.ray.models.HeadGroupSpec],
    enable_autoscaling: bool,
    autoscaler_options: typing.Optional[flytekitplugins.ray.models.AutoscalerOptions],
)
```
| Parameter | Type | Description |
|-|-|-|
| `worker_group_spec` | `typing.List[flytekitplugins.ray.models.WorkerGroupSpec]` | |
| `head_group_spec` | `typing.Optional[flytekitplugins.ray.models.HeadGroupSpec]` | |
| `enable_autoscaling` | `bool` | |
| `autoscaler_options` | `typing.Optional[flytekitplugins.ray.models.AutoscalerOptions]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `autoscaler_options` | `typing.Optional[flytekitplugins.ray.models.AutoscalerOptions]` |  |
| `enable_autoscaling` | `bool` | Whether to enable autoscaling. |
| `head_group_spec` | `flytekitplugins.ray.models.HeadGroupSpec` | The head group configuration. |
| `is_empty` | `None` |  |
| `worker_group_spec` | `typing.List[flytekitplugins.ray.models.WorkerGroupSpec]` | The worker group configurations. |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    proto,
)
```
| Parameter | Type | Description |
|-|-|-|
| `proto` |  | |

**Returns:** RayCluster

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.plugins._ray_pb2.RayCluster

## flytekitplugins.ray.models.RayJob

Models _ray_pb2.RayJob

### Parameters

```python
class RayJob(
    ray_cluster: flytekitplugins.ray.models.RayCluster,
    runtime_env: typing.Optional[str],
    runtime_env_yaml: typing.Optional[str],
    ttl_seconds_after_finished: typing.Optional[int],
    shutdown_after_job_finishes: bool,
)
```
| Parameter | Type | Description |
|-|-|-|
| `ray_cluster` | `flytekitplugins.ray.models.RayCluster` | |
| `runtime_env` | `typing.Optional[str]` | |
| `runtime_env_yaml` | `typing.Optional[str]` | |
| `ttl_seconds_after_finished` | `typing.Optional[int]` | |
| `shutdown_after_job_finishes` | `bool` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `is_empty` | `None` |  |
| `ray_cluster` | `flytekitplugins.ray.models.RayCluster` |  |
| `runtime_env` | `typing.Optional[str]` |  |
| `runtime_env_yaml` | `typing.Optional[str]` |  |
| `shutdown_after_job_finishes` | `bool` |  |
| `ttl_seconds_after_finished` | `typing.Optional[int]` |  |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    proto: flyteidl.plugins.ray_pb2.RayJob,
)
```
| Parameter | Type | Description |
|-|-|-|
| `proto` | `flyteidl.plugins.ray_pb2.RayJob` | |

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
## flytekitplugins.ray.models.WorkerGroupSpec

### Parameters

```python
class WorkerGroupSpec(
    group_name: str,
    replicas: int,
    min_replicas: typing.Optional[int],
    max_replicas: typing.Optional[int],
    ray_start_params: typing.Optional[typing.Dict[str, str]],
    k8s_pod: typing.Optional[flytekit.models.task.K8sPod],
)
```
| Parameter | Type | Description |
|-|-|-|
| `group_name` | `str` | |
| `replicas` | `int` | |
| `min_replicas` | `typing.Optional[int]` | |
| `max_replicas` | `typing.Optional[int]` | |
| `ray_start_params` | `typing.Optional[typing.Dict[str, str]]` | |
| `k8s_pod` | `typing.Optional[flytekit.models.task.K8sPod]` | |

### Properties

| Property | Type | Description |
|-|-|-|
| `group_name` | `None` | Group name of the current worker group. |
| `is_empty` | `None` |  |
| `k8s_pod` | `None` | Additional pod specs for the worker node pods. |
| `max_replicas` | `None` | Max replicas of the worker group. |
| `min_replicas` | `None` | Min replicas of the worker group. |
| `ray_start_params` | `None` | The ray start params of worker node group. |
| `replicas` | `None` | Desired replicas of the worker group. |

### Methods

| Method | Description |
|-|-|
| [`from_flyte_idl()`](#from_flyte_idl) |  |
| [`serialize_to_string()`](#serialize_to_string) |  |
| [`short_string()`](#short_string) |  |
| [`to_flyte_idl()`](#to_flyte_idl) |  |

#### from_flyte_idl()

```python
def from_flyte_idl(
    proto,
)
```
| Parameter | Type | Description |
|-|-|-|
| `proto` |  | |

**Returns:** WorkerGroupSpec

#### serialize_to_string()

```python
def serialize_to_string()
```
#### short_string()

```python
def short_string()
```
**Returns:** Text

#### to_flyte_idl()

```python
def to_flyte_idl()
```
**Returns:** flyteidl.plugins._ray_pb2.WorkerGroupSpec

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/plugins/ray/packages/flytekitplugins.ray.models.md
**HTML**: https://www.union.ai/docs/v1/flyte/api-reference/plugins/ray/packages/flytekitplugins.ray.models/
