mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

OSS release tests currently run with hardcoded Python 3.7 base. In the future we will want to run tests on different python versions. This PR adds support for a new `python` field in the test configuration. The python field will determine both the base image used in the Buildkite runner docker container (for Ray client compatibility) and the base image for the Anyscale cluster environments. Note that in Buildkite, we will still only wait for the python 3.7 base image before kicking off tests. That is acceptable, as we can assume that most wheels finish in a similar time, so even if we wait for the 3.7 image and kick off a 3.8 test, that runner will wait maybe for 5-10 more minutes.
66 lines
1.9 KiB
Python
66 lines
1.9 KiB
Python
import sys
|
|
import unittest
|
|
|
|
from ray_release.config import Test
|
|
from ray_release.exception import ReleaseTestConfigError
|
|
from ray_release.template import populate_cluster_env_variables, render_yaml_template
|
|
|
|
TEST_APP_CONFIG_CPU = """
|
|
base_image: {{ env["RAY_IMAGE_NIGHTLY_CPU"] | default("anyscale/ray:nightly-py37") }}
|
|
env_vars: {}
|
|
debian_packages:
|
|
- curl
|
|
"""
|
|
|
|
TEST_APP_CONFIG_GPU = """
|
|
base_image: {{ env["RAY_IMAGE_ML_NIGHTLY_GPU"] | default("anyscale/ray-ml:nightly-py37-gpu") }}
|
|
env_vars: {}
|
|
debian_packages:
|
|
- curl
|
|
""" # noqa: E501
|
|
|
|
|
|
class TemplateTest(unittest.TestCase):
|
|
def testPythonVersionDefaultCPU(self):
|
|
test = Test()
|
|
|
|
env = populate_cluster_env_variables(test, ray_wheels_url="")
|
|
result = render_yaml_template(TEST_APP_CONFIG_CPU, env=env)
|
|
|
|
assert result["base_image"] == "anyscale/ray:nightly-py37"
|
|
|
|
def testPythonVersion39CPU(self):
|
|
test = Test(python="3.9")
|
|
|
|
env = populate_cluster_env_variables(test, ray_wheels_url="")
|
|
result = render_yaml_template(TEST_APP_CONFIG_CPU, env=env)
|
|
|
|
assert result["base_image"] == "anyscale/ray:nightly-py39"
|
|
|
|
def testPythonVersionDefaultGPU(self):
|
|
test = Test()
|
|
|
|
env = populate_cluster_env_variables(test, ray_wheels_url="")
|
|
result = render_yaml_template(TEST_APP_CONFIG_GPU, env=env)
|
|
|
|
assert result["base_image"] == "anyscale/ray-ml:nightly-py37-gpu"
|
|
|
|
def testPythonVersion39GPU(self):
|
|
test = Test(python="3.9")
|
|
|
|
env = populate_cluster_env_variables(test, ray_wheels_url="")
|
|
result = render_yaml_template(TEST_APP_CONFIG_GPU, env=env)
|
|
|
|
assert result["base_image"] == "anyscale/ray-ml:nightly-py39-gpu"
|
|
|
|
def testPythonVersionInvalid(self):
|
|
test = Test(python="3.x")
|
|
|
|
with self.assertRaises(ReleaseTestConfigError):
|
|
populate_cluster_env_variables(test, ray_wheels_url="")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import pytest
|
|
|
|
sys.exit(pytest.main(["-v", __file__]))
|