diff --git a/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration.py b/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration.py index e217bb500..fe203fb27 100644 --- a/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration.py +++ b/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration.py @@ -8,17 +8,16 @@ def ray_fn(openshift_server: str, openshift_token: str) -> int: import ray from codeflare_sdk.cluster.auth import TokenAuthentication from codeflare_sdk.cluster.cluster import Cluster, ClusterConfiguration + from codeflare_sdk import generate_cert print("before login") auth = TokenAuthentication(token=openshift_token, server=openshift_server, skip_tls=True) auth_return = auth.login() print(f'auth_return: "{auth_return}"') print("after login") - # openshift_oauth is a workaround for RHOAIENG-3981 cluster = Cluster( ClusterConfiguration( name="raytest", - openshift_oauth=True, num_workers=1, head_cpus="500m", min_memory=1, @@ -26,6 +25,7 @@ def ray_fn(openshift_server: str, openshift_token: str) -> int: num_gpus=0, image="quay.io/project-codeflare/ray:latest-py39-cu118", instascale=False, + verify_tls=False ) ) @@ -48,7 +48,9 @@ def ray_fn(openshift_server: str, openshift_token: str) -> int: # reset the ray context in case there's already one. ray.shutdown() # establish connection to ray cluster - ray.init(address=ray_cluster_uri) + generate_cert.generate_tls_cert(cluster.config.name, cluster.config.namespace) + generate_cert.export_env(cluster.config.name, cluster.config.namespace) + ray.init(address=cluster.cluster_uri()) print("Ray cluster is up and running: ", ray.is_initialized()) @ray.remote diff --git a/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration_compiled.yaml b/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration_compiled.yaml index 3448bb6b2..00f93887f 100644 --- a/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration_compiled.yaml +++ b/ods_ci/tests/Resources/Files/pipeline-samples/v2/ray_integration_compiled.yaml @@ -49,16 +49,15 @@ deploymentSpec: \ *\n\ndef ray_fn(openshift_server: str, openshift_token: str) -> int:\n\ \ import ray\n from codeflare_sdk.cluster.auth import TokenAuthentication\n\ \ from codeflare_sdk.cluster.cluster import Cluster, ClusterConfiguration\n\ - \n print(\"before login\")\n auth = TokenAuthentication(token=openshift_token,\ - \ server=openshift_server, skip_tls=True)\n auth_return = auth.login()\n\ - \ print(f'auth_return: \"{auth_return}\"')\n print(\"after login\"\ - )\n cluster = Cluster(\n ClusterConfiguration(\n name=\"\ - raytest\",\n # namespace must exist, and it is the same from\ - \ 432__data-science-pipelines-tekton.robot\n namespace=\"pipelineskfp1\"\ - ,\n num_workers=1,\n head_cpus=\"500m\",\n \ - \ min_memory=1,\n max_memory=1,\n num_gpus=0,\n\ - \ image=\"quay.io/project-codeflare/ray:latest-py39-cu118\",\n\ - \ instascale=False,\n )\n )\n\n # always clean the\ + \ from codeflare_sdk import generate_cert\n\n print(\"before login\"\ + )\n auth = TokenAuthentication(token=openshift_token, server=openshift_server,\ + \ skip_tls=True)\n auth_return = auth.login()\n print(f'auth_return:\ + \ \"{auth_return}\"')\n print(\"after login\")\n cluster = Cluster(\n\ + \ ClusterConfiguration(\n name=\"raytest\",\n \ + \ num_workers=1,\n head_cpus=\"500m\",\n min_memory=1,\n\ + \ max_memory=1,\n num_gpus=0,\n image=\"\ + quay.io/project-codeflare/ray:latest-py39-cu118\",\n instascale=False,\n\ + \ verify_tls=False\n )\n )\n\n # always clean the\ \ resources\n cluster.down()\n print(cluster.status())\n cluster.up()\n\ \ cluster.wait_ready()\n print(cluster.status())\n print(cluster.details())\n\ \n ray_dashboard_uri = cluster.cluster_dashboard_uri()\n ray_cluster_uri\ @@ -67,10 +66,12 @@ deploymentSpec: \ empty\n assert ray_cluster_uri, \"Ray cluster needs to be started and\ \ set before proceeding\"\n\n # reset the ray context in case there's\ \ already one.\n ray.shutdown()\n # establish connection to ray cluster\n\ - \ ray.init(address=ray_cluster_uri)\n print(\"Ray cluster is up and\ - \ running: \", ray.is_initialized())\n\n @ray.remote\n def train_fn():\n\ - \ return 100\n\n result = ray.get(train_fn.remote())\n assert\ - \ 100 == result\n ray.shutdown()\n cluster.down()\n auth.logout()\n\ + \ generate_cert.generate_tls_cert(cluster.config.name, cluster.config.namespace)\n\ + \ generate_cert.export_env(cluster.config.name, cluster.config.namespace)\n\ + \ ray.init(address=cluster.cluster_uri())\n print(\"Ray cluster is\ + \ up and running: \", ray.is_initialized())\n\n @ray.remote\n def\ + \ train_fn():\n return 100\n\n result = ray.get(train_fn.remote())\n\ + \ assert 100 == result\n ray.shutdown()\n cluster.down()\n auth.logout()\n\ \ return result\n\n" image: registry.redhat.io/ubi8/python-39@sha256:3523b184212e1f2243e76d8094ab52b01ea3015471471290d011625e1763af61 pipelineInfo: