Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions demo-notebooks/additional-demos/hf_interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication"
"from codeflare_sdk import RayCluster, TokenAuthentication"
]
},
{
Expand Down Expand Up @@ -86,21 +86,20 @@
"# Create our cluster and submit\n",
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster_name= \"hfgputest\"\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name=cluster_name, \n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':1},\n",
" head_accelerators={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':1},\n",
" num_workers=1,\n",
" worker_cpu_requests=8, \n",
" worker_cpu_limits=8, \n",
" worker_memory_requests=16, \n",
" worker_memory_limits=16, \n",
" # image=\"\", # Optional Field \n",
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down Expand Up @@ -204,8 +203,8 @@
"source": [
"from codeflare_sdk import generate_cert\n",
"# Create required TLS cert and export the environment variables to enable TLS\n",
"generate_cert.generate_tls_cert(cluster_name, cluster.config.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.config.namespace)"
"generate_cert.generate_tls_cert(cluster_name, cluster.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.namespace)"
]
},
{
Expand Down
15 changes: 7 additions & 8 deletions demo-notebooks/additional-demos/local_interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication"
"from codeflare_sdk import RayCluster, TokenAuthentication"
]
},
{
Expand Down Expand Up @@ -56,21 +56,20 @@
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster_name = \"hfgputest-1\"\n",
"\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name=cluster_name,\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':0},\n",
" head_accelerators={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':0},\n",
" num_workers=1,\n",
" worker_cpu_requests=1,\n",
" worker_cpu_limits=1,\n",
" worker_memory_requests=4,\n",
" worker_memory_limits=6,\n",
" # image=\"\", # Optional Field \n",
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down Expand Up @@ -114,8 +113,8 @@
"source": [
"from codeflare_sdk import generate_cert\n",
"\n",
"generate_cert.generate_tls_cert(cluster_name, cluster.config.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.config.namespace)"
"generate_cert.generate_tls_cert(cluster_name, cluster.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.namespace)"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions demo-notebooks/additional-demos/ray_job_client.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication, RayJobClient"
"from codeflare_sdk import RayCluster, TokenAuthentication, RayJobClient"
]
},
{
Expand Down Expand Up @@ -57,12 +57,12 @@
"source": [
"# Create and configure our cluster object\n",
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name='jobtest',\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':0},\n",
" head_accelerators={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':0},\n",
" num_workers=2,\n",
" worker_cpu_requests=1,\n",
" worker_cpu_limits=1,\n",
Expand All @@ -71,7 +71,7 @@
" # image=\"\", # Optional Field \n",
" write_to_file=False # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down
15 changes: 7 additions & 8 deletions demo-notebooks/guided-demos/1_cluster_job_client.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication"
"from codeflare_sdk import RayCluster, TokenAuthentication"
]
},
{
Expand Down Expand Up @@ -57,23 +57,22 @@
"source": [
"# Create and configure our cluster object\n",
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name='jobtest',\n",
" head_cpu_requests=1,\n",
" head_cpu_limits=1,\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':1},\n",
" head_accelerators={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':1},\n",
" num_workers=2,\n",
" worker_cpu_requests='250m',\n",
" worker_cpu_limits=1,\n",
" worker_memory_requests=4,\n",
" worker_memory_limits=6,\n",
" # image=\"\", # Optional Field \n",
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down Expand Up @@ -229,7 +228,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -243,7 +242,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
15 changes: 7 additions & 8 deletions demo-notebooks/guided-demos/2_basic_interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication"
"from codeflare_sdk import RayCluster, TokenAuthentication"
]
},
{
Expand Down Expand Up @@ -62,23 +62,22 @@
"# Create and configure our cluster object\n",
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster_name = \"interactivetest\"\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name=cluster_name,\n",
" head_cpu_requests=1,\n",
" head_cpu_limits=1,\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':1},\n",
" head_accelerators={'nvidia.com/gpu':1}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':1},\n",
" num_workers=2,\n",
" worker_cpu_requests='250m',\n",
" worker_cpu_limits=1,\n",
" worker_memory_requests=4,\n",
" worker_memory_limits=6,\n",
" # image=\"\", # Optional Field \n",
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down Expand Up @@ -151,8 +150,8 @@
"source": [
"from codeflare_sdk import generate_cert\n",
"# Create required TLS cert and export the environment variables to enable TLS\n",
"generate_cert.generate_tls_cert(cluster_name, cluster.config.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.config.namespace)"
"generate_cert.generate_tls_cert(cluster_name, cluster.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.namespace)"
]
},
{
Expand Down
11 changes: 5 additions & 6 deletions demo-notebooks/guided-demos/3_widget_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"outputs": [],
"source": [
"# Import pieces from codeflare-sdk\n",
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication, view_clusters"
"from codeflare_sdk import RayCluster, TokenAuthentication, view_clusters"
]
},
{
Expand Down Expand Up @@ -64,23 +64,22 @@
"source": [
"# Create and configure our cluster object\n",
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name='widgettest',\n",
" head_cpu_requests='500m',\n",
" head_cpu_limits='500m',\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n",
" worker_extended_resource_requests={'nvidia.com/gpu':0},\n",
" head_accelerators={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_accelerators and worker_accelerators\n",
" worker_accelerators={'nvidia.com/gpu':0},\n",
" num_workers=2,\n",
" worker_cpu_requests='250m',\n",
" worker_cpu_limits=1,\n",
" worker_memory_requests=4,\n",
" worker_memory_limits=6,\n",
" # image=\"\", # Optional Field\n",
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources\n",
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n",
"))"
")"
]
},
{
Expand Down
11 changes: 5 additions & 6 deletions demo-notebooks/guided-demos/4_rayjob_existing_cluster.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"metadata": {},
"outputs": [],
"source": [
"from codeflare_sdk import Cluster, ClusterConfiguration, RayJob"
"from codeflare_sdk import RayCluster, RayJob"
]
},
{
Expand Down Expand Up @@ -73,21 +73,20 @@
"metadata": {},
"outputs": [],
"source": [
"cluster = Cluster(ClusterConfiguration(\n",
"cluster = RayCluster(\n",
" name='rayjob-cluster',\n",
" head_cpu_requests=1,\n",
" head_cpu_limits=1,\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" head_extended_resource_requests={'nvidia.com/gpu':1},\n",
" worker_extended_resource_requests={'nvidia.com/gpu':1},\n",
" head_accelerators={'nvidia.com/gpu':1},\n",
" worker_accelerators={'nvidia.com/gpu':1},\n",
" num_workers=2,\n",
" worker_cpu_requests='250m',\n",
" worker_cpu_limits=1,\n",
" worker_memory_requests=4,\n",
" worker_memory_limits=6,\n",
"\n",
"))\n",
")\n",
"\n",
"cluster.apply()"
]
Expand Down
8 changes: 4 additions & 4 deletions demo-notebooks/guided-demos/5_submit_rayjob_cr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"metadata": {},
"outputs": [],
"source": [
"from codeflare_sdk import RayJob, ManagedClusterConfig"
"from codeflare_sdk import RayJob, RayCluster"
]
},
{
Expand All @@ -55,7 +55,7 @@
"id": "5581eca9",
"metadata": {},
"source": [
"Next we'll need to define the ManagedClusterConfig. Kuberay will use this to spin up a short-lived RayCluster that will only exist as long as the job"
"Next we'll need to define the RayCluster configuration. Kuberay will use this to spin up a short-lived RayCluster that will only exist as long as the job"
]
},
{
Expand All @@ -65,7 +65,7 @@
"metadata": {},
"outputs": [],
"source": [
"cluster_config = ManagedClusterConfig(\n",
"cluster_config = RayCluster(\n",
" head_memory_requests=6,\n",
" head_memory_limits=8,\n",
" num_workers=2,\n",
Expand All @@ -83,7 +83,7 @@
"id": "02a2b32b",
"metadata": {},
"source": [
"Lastly we can pass the ManagedClusterConfig into the RayJob and submit it. You do not need to worry about tearing down the cluster when the job has completed, that is handled for you!"
"Lastly we can pass the RayCluster configuration into the RayJob and submit it. You do not need to worry about tearing down the cluster when the job has completed, that is handled for you!"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ kubernetes = ">= 27.2.0"
cryptography = "43.0.3"
executing = "1.2.0"
pydantic = ">= 2.10.6"
typing_extensions = ">= 4.12.0"
ipywidgets = "8.1.2"

[[tool.poetry.source]]
Expand Down
9 changes: 5 additions & 4 deletions src/codeflare_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from .ray import (
Cluster,
ClusterConfiguration,
Cluster, # Deprecated, use RayCluster instead
ClusterConfiguration, # Deprecated, use RayCluster instead
RayCluster, # New unified class (recommended) - combines config + operations
RayClusterInfo, # Status info dataclass
RayClusterStatus,
CodeFlareClusterStatus,
RayCluster,
get_cluster,
list_all_queued,
list_all_clusters,
AWManager,
AppWrapperStatus,
RayJobClient,
RayJob,
ManagedClusterConfig,
ManagedClusterConfig, # Deprecated, use RayCluster instead
)

from .common.widgets import view_clusters
Expand Down
9 changes: 5 additions & 4 deletions src/codeflare_sdk/ray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@

from .rayjobs import (
RayJob,
ManagedClusterConfig,
ManagedClusterConfig, # Deprecated, use RayCluster instead
RayJobDeploymentStatus,
CodeflareRayJobStatus,
RayJobInfo,
)

from .cluster import (
Cluster,
ClusterConfiguration,
Cluster, # Deprecated, use RayCluster instead
ClusterConfiguration, # Deprecated, use RayCluster instead
RayCluster, # New unified class (recommended) - combines config + operations
RayClusterInfo, # Status info dataclass
get_cluster,
list_all_queued,
list_all_clusters,
RayClusterStatus,
CodeFlareClusterStatus,
RayCluster,
)
Loading
Loading