generated from astronomer/airflow-provider-sample
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Documentation changes * Added connection screenshot
- Loading branch information
1 parent
0e54ba3
commit 05a5e59
Showing
11 changed files
with
77 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
ray\_provider.decorators package | ||
================================ | ||
|
||
Submodules | ||
Decorators | ||
---------- | ||
|
||
ray\_provider.decorators.ray module | ||
----------------------------------- | ||
|
||
.. automodule:: ray_provider.decorators.ray | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: ray_provider.decorators | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
ray\_provider.hooks package | ||
=========================== | ||
|
||
Submodules | ||
---------- | ||
|
||
ray\_provider.hooks.ray module | ||
------------------------------ | ||
Hook | ||
----- | ||
|
||
.. automodule:: ray_provider.hooks.ray | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: ray_provider.hooks | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
ray\_provider.operators package | ||
=============================== | ||
|
||
Submodules | ||
---------- | ||
|
||
ray\_provider.operators.ray module | ||
---------------------------------- | ||
Operators | ||
--------- | ||
|
||
.. automodule:: ray_provider.operators.ray | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: ray_provider.operators | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
ray\_provider.triggers package | ||
============================== | ||
|
||
Submodules | ||
---------- | ||
|
||
ray\_provider.triggers.ray module | ||
--------------------------------- | ||
Trigger | ||
-------- | ||
|
||
.. automodule:: ray_provider.triggers.ray | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: ray_provider.triggers | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
Code Samples | ||
^^^^^^^^^^^^^^^ | ||
============ | ||
|
||
There are two main scenarios for using this provider: | ||
|
||
Scenario 1: Setting up a Ray cluster on an existing Kubernetes cluster | ||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
---------------------------------------------------------------------- | ||
|
||
If you have an existing Kubernetes cluster and want to install a Ray cluster on it, and then run a Ray job, you can use the ``SetupRayCluster``, ``SubmitRayJob``, and ``DeleteRayCluster`` operators. Here's an example DAG (``setup_teardown.py``): | ||
If you have an existing Kubernetes cluster and want to install a Ray cluster on it, and then run a Ray job, you can use the ``SetupRayCluster``, ``SubmitRayJob``, and ``DeleteRayCluster`` operators. | ||
|
||
This will involve 2 steps - | ||
|
||
Create a YAML file defining your Ray cluster configuration. | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
.. note:: | ||
``spec.headGroupSpec.serviceType`` must be a 'LoadBalancer' to spin a service that exposes your dashboard externally | ||
|
||
.. literalinclude:: ../../example_dags/scripts/ray.yaml | ||
|
||
Save this file in a location accessible to your Airflow installation, and reference it in your DAG code. | ||
|
||
|
||
Sample DAG (``setup_teardown.py``): | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. literalinclude:: ../../example_dags/setup-teardown.py | ||
:language: python | ||
:linenos: | ||
|
||
Scenario 2: Using an existing Ray cluster | ||
""""""""""""""""""""""""""""""""""""""""" | ||
----------------------------------------- | ||
|
||
If you already have a Ray cluster set up, you can use the ``SubmitRayJob`` operator or ``task.ray()`` decorator to submit jobs directly. | ||
|
||
In the below example(``ray_taskflow_example.py``), the ``@task.ray`` decorator is used to define a task that will be executed on the Ray cluster. | ||
In the example below (``ray_taskflow_example.py``), the ``@task.ray`` decorator is used to define a task that will be executed on the Ray cluster: | ||
|
||
.. literalinclude:: ../../example_dags/ray_taskflow_example.py | ||
:language: python | ||
:linenos: | ||
|
||
Remember to adjust file paths, connection IDs, and other specifics according to your setup. | ||
.. note:: | ||
Remember to adjust file paths, connection IDs, and other specifics according to your setup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,42 @@ | ||
Getting started | ||
~~~~~~~~~~~~~~~ | ||
Getting Started | ||
=============== | ||
|
||
1. Pre-requisites | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
The ``SetupRayCluster`` and the ``DeleteRayCluster`` operator require helm to install the kuberay operator. See the `installing Helm <https://helm.sh/docs/intro/install/>`_ page for more details. | ||
|
||
2. Installation | ||
^^^^^^^^^^^^^^^ | ||
**1. Install Helm:** | ||
|
||
.. code-block:: sh | ||
pip install astro-provider-ray | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
The astro-provider-ray source code is available on this GitHub `page <https://github.com/astronomer/astro-provider-ray>`_ | ||
See the `installing Helm <https://helm.sh/docs/intro/install/>`_ page for other options. | ||
|
||
3. Setting up the connection | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
.. note:: | ||
This step is only required if you intend to use the ``SetupRayCluster`` & ``DeleteRayCluster`` operators. | ||
|
||
For SubmitRayJob operator (using an existing Ray cluster) | ||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
**2. Install the python package:** | ||
|
||
- **Connection Type**: "Ray" | ||
- **Connection ID**: e.g., "ray_conn" | ||
- **Ray dashboard URL**: URL of the Ray dashboard | ||
- **Optional fields**: Cookies, Metadata, Headers, Verify SSL | ||
.. code-block:: sh | ||
pip install astro-provider-ray | ||
For SetupRayCluster and DeleteRayCluster operators | ||
"""""""""""""""""""""""""""""""""""""""""""""""""" | ||
- **Connection Type**: "Ray" | ||
- **Connection ID**: e.g., "ray_k8s_conn" | ||
- **Kube config path** OR **Kube config content (JSON format)** : Kubeconfig of the kubernetes cluster where Ray cluster must be setup | ||
- **Namespace**: The k8 namespace where your cluster must be created. If not provided, "default" is used | ||
- **Optional fields**: Cluster context, Disable SSL, Disable TCP keepalive | ||
**3. Setting up the connection** | ||
|
||
5. Setting up the Ray cluster spec | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
.. image:: ../_static/connection.png | ||
:align: center | ||
|
||
Create a YAML file defining your Ray cluster configuration. Example: | ||
- For SubmitRayJob operator (using an existing Ray cluster) | ||
|
||
**Note:** ``spec.headGroupSpec.serviceType`` must be a 'LoadBalancer' to spin a service that exposes your dashboard externally | ||
- **Connection Type**: "Ray" | ||
- **Connection ID**: e.g., "ray_conn" | ||
- **Ray dashboard URL**: URL of the Ray dashboard | ||
- **Optional fields**: Cookies, Metadata, Headers, Verify SSL | ||
|
||
.. literalinclude:: ../../example_dags/scripts/ray.yaml | ||
- For SetupRayCluster and DeleteRayCluster operators | ||
|
||
Save this file in a location accessible to your Airflow installation, and reference it in your DAG code. | ||
- **Connection Type**: "Ray" | ||
- **Connection ID**: e.g., "ray_k8s_conn" | ||
- **Kube config path** OR **Kube config content (JSON format)**: Kubeconfig of the Kubernetes cluster where Ray cluster must be set up | ||
- **Namespace**: The K8s namespace where your cluster must be created. If not provided, "default" is used | ||
- **Optional fields**: Cluster context, Disable SSL, Disable TCP keepalive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters