|
44 | 44 | "metadata": {}, |
45 | 45 | "outputs": [], |
46 | 46 | "source": [ |
47 | | - "from codeflare_sdk import Codeflare, SDKConfig\n", |
| 47 | + "from codeflare_sdk import ClusterConfiguration, Codeflare, SDKConfig\n", |
48 | 48 | "from kube_authkit import AuthConfig" |
49 | 49 | ] |
50 | 50 | }, |
|
116 | 116 | "source": [ |
117 | 117 | "## Step 3: Create and bring up a Ray cluster\n", |
118 | 118 | "\n", |
119 | | - "Use `cf.clusters.create()` to build a `Cluster` object. All keyword arguments\n", |
120 | | - "are forwarded to `ClusterConfiguration`. The namespace is inherited from\n", |
121 | | - "`SDKConfig` unless you override it." |
| 119 | + "Use `cf.clusters.create()` to build a `Cluster` object from a\n", |
| 120 | + "`ClusterConfiguration` — the same object `cf.jobs` and `Cluster()` take. The\n", |
| 121 | + "namespace is inherited from `SDKConfig` unless the config or the call overrides\n", |
| 122 | + "it." |
122 | 123 | ] |
123 | 124 | }, |
124 | 125 | { |
|
129 | 130 | "outputs": [], |
130 | 131 | "source": [ |
131 | 132 | "cluster = cf.clusters.create(\n", |
132 | | - " name=\"entrypoint-demo\",\n", |
133 | | - " num_workers=2,\n", |
134 | | - " head_cpu_requests=\"500m\",\n", |
135 | | - " head_cpu_limits=\"500m\",\n", |
136 | | - " head_memory_requests=5,\n", |
137 | | - " head_memory_limits=8,\n", |
138 | | - " worker_cpu_requests=\"250m\",\n", |
139 | | - " worker_cpu_limits=1,\n", |
140 | | - " worker_memory_requests=4,\n", |
141 | | - " worker_memory_limits=6,\n", |
142 | | - " head_extended_resource_requests={\"nvidia.com/gpu\": 0},\n", |
143 | | - " worker_extended_resource_requests={\"nvidia.com/gpu\": 0},\n", |
144 | | - " write_to_file=False,\n", |
145 | | - " # local_queue=\"your-local-queue\", # optional — auto-detected if omitted\n", |
| 133 | + " ClusterConfiguration(\n", |
| 134 | + " name=\"entrypoint-demo\",\n", |
| 135 | + " num_workers=2,\n", |
| 136 | + " head_cpu_requests=\"500m\",\n", |
| 137 | + " head_cpu_limits=\"500m\",\n", |
| 138 | + " head_memory_requests=5,\n", |
| 139 | + " head_memory_limits=8,\n", |
| 140 | + " worker_cpu_requests=\"250m\",\n", |
| 141 | + " worker_cpu_limits=1,\n", |
| 142 | + " worker_memory_requests=4,\n", |
| 143 | + " worker_memory_limits=6,\n", |
| 144 | + " head_extended_resource_requests={\"nvidia.com/gpu\": 0},\n", |
| 145 | + " worker_extended_resource_requests={\"nvidia.com/gpu\": 0},\n", |
| 146 | + " write_to_file=False,\n", |
| 147 | + " # local_queue=\"your-local-queue\", # optional — auto-detected if omitted\n", |
| 148 | + " )\n", |
146 | 149 | ")" |
147 | 150 | ] |
148 | 151 | }, |
|
193 | 196 | "id": "m1b2c3d4", |
194 | 197 | "metadata": {}, |
195 | 198 | "outputs": [], |
196 | | - "source": "from codeflare_sdk import ClusterConfiguration\n\njob = cf.jobs.submit(\n name=\"entrypoint-demo-job\",\n entrypoint=\"python -c 'import ray; ray.init(); print(\\\"Hello from the Codeflare entrypoint!\\\")'\",\n cluster_config=ClusterConfiguration(\n head_memory_requests=6,\n head_memory_limits=8,\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 ),\n)" |
| 199 | + "source": [ |
| 200 | + "job = cf.jobs.submit(\n", |
| 201 | + " name=\"entrypoint-demo-job\",\n", |
| 202 | + " entrypoint=\"python -c 'import ray; ray.init(); print(\\\"Hello from the Codeflare entrypoint!\\\")'\",\n", |
| 203 | + " cluster_config=ClusterConfiguration(\n", |
| 204 | + " head_memory_requests=6,\n", |
| 205 | + " head_memory_limits=8,\n", |
| 206 | + " num_workers=1,\n", |
| 207 | + " worker_cpu_requests=1,\n", |
| 208 | + " worker_cpu_limits=1,\n", |
| 209 | + " worker_memory_requests=4,\n", |
| 210 | + " worker_memory_limits=6,\n", |
| 211 | + " ),\n", |
| 212 | + ")" |
| 213 | + ] |
197 | 214 | }, |
198 | 215 | { |
199 | 216 | "cell_type": "code", |
|
0 commit comments