Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
review comments
Browse files Browse the repository at this point in the history
akihikokuroda committed Nov 9, 2023
1 parent b07ced0 commit 626fb5f
Showing 7 changed files with 56 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -292,6 +292,12 @@ spec:
value: {{ .Release.Namespace }}
- name: RAY_NODE_IMAGE
value: {{ .Values.application.ray.nodeImage | quote }}
- name: RAY_NODE_IMAGE_PY38
value: {{ .Values.application.ray.nodeImage_py38 | quote }}
- name: RAY_NODE_IMAGE_PY39
value: {{ .Values.application.ray.nodeImage_py39 | quote }}
- name: RAY_NODE_IMAGE_PY310
value: {{ .Values.application.ray.nodeImage_py310 | quote }}
- name: LIMITS_JOBS_PER_USER
value: {{ .Values.application.limits.maxJobsPerUser | quote }}
- name: LIMITS_MAX_CLUSTERS
3 changes: 3 additions & 0 deletions charts/quantum-serverless/charts/gateway/values.yaml
Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@ application:
enable: true
ray:
nodeImage: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.1-py39"
nodeImage_py38: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.1-py38"
nodeImage_py39: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.1-py39"
nodeImage_py310: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.1-py310"
cpu: 2
memory: 2
replicas: 1
30 changes: 13 additions & 17 deletions gateway/api/migrations/0011_jobconfig_job_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 4.2.2 on 2023-11-03 17:54
# Generated by Django 4.2.2 on 2023-11-09 13:06

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
@@ -27,25 +26,22 @@ class Migration(migrations.Migration):
),
("created", models.DateTimeField(auto_now_add=True)),
("auto_scaling", models.BooleanField(default=False, null=True)),
("workers", models.IntegerField(null=True)),
("min_workers", models.IntegerField(null=True)),
("max_workers", models.IntegerField(null=True)),
(
"workers",
models.IntegerField(
"python_version",
models.CharField(
blank=True,
choices=[
("py38", "Version 3.8"),
("py39", "Version 3.9"),
("py310", "Version 3.10"),
],
max_length=6,
null=True,
),
),
(
"min_workers",
models.IntegerField(
null=True,
),
),
(
"max_workers",
models.IntegerField(
null=True,
),
),
("python_version", models.TextField(blank=True, null=True)),
],
),
migrations.AddField(
15 changes: 14 additions & 1 deletion gateway/api/models.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,20 @@ class JobConfig(models.Model):
max_workers = models.IntegerField(
null=True,
)
python_version = models.TextField(null=True, blank=True)
PYTHON_V3_8 = "py38"
PYTHON_V3_9 = "py39"
PYTHON_V3_10 = "py310"
PYTHON_VERSIONS = [
(PYTHON_V3_8, "Version 3.8"),
(PYTHON_V3_9, "Version 3.9"),
(PYTHON_V3_10, "Version 3.10"),
]
python_version = models.CharField(
max_length=6,
choices=PYTHON_VERSIONS,
null=True,
blank=True,
)

def __str__(self):
return self.id
19 changes: 12 additions & 7 deletions gateway/api/ray.py
Original file line number Diff line number Diff line change
@@ -188,14 +188,19 @@ def create_ray_cluster(
if not job_config.auto_scaling:
job_config.auto_scaling = settings.RAY_CLUSTER_WORKER_AUTO_SCALING
if not job_config.python_version:
job_config.python_version = settings.RAY_PYTHON_VERSION
job_config.python_version = "default"

py_version = job_config.python_version
node_image = (
settings.RAY_NODE_IMAGE[: settings.RAY_NODE_IMAGE.rindex("-")]
+ "-"
+ py_version
)
if job_config.python_version in settings.RAY_NODE_IMAGES_MAP:
node_image = settings.RAY_NODE_IMAGES_MAP[job_config.python_version]
else:
message = (
"Specified python version {job_config.python_version} "
"not in a list of supported python versions "
"{list(settings.RAY_NODE_IMAGES_MAP.keys())}. "
"Default image will be used instead."
)
logger.warning(message)
node_image = settings.RAY_NODE_IMAGE
cluster = get_template("rayclustertemplate.yaml")
manifest = cluster.render(
{
4 changes: 3 additions & 1 deletion gateway/api/serializers.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,9 @@ class Meta:
auto_scaling = serializers.BooleanField(
default=False, required=False, allow_null=True
)
python_version = serializers.CharField(required=False, allow_null=True)
python_version = serializers.CharField(
required=False, allow_null=True, allow_blank=True
)


class ProgramSerializer(serializers.ModelSerializer):
6 changes: 5 additions & 1 deletion gateway/main/settings.py
Original file line number Diff line number Diff line change
@@ -303,7 +303,11 @@
RAY_NODE_IMAGE = os.environ.get(
"RAY_NODE_IMAGE", "icr.io/quantum-public/quantum-serverless-ray-node:0.6.6-py39"
)
RAY_PYTHON_VERSION = RAY_NODE_IMAGE[RAY_NODE_IMAGE.rindex("-") + 1 :]
RAY_NODE_IMAGES_MAP = {
"py38": os.environ.get("RAY_NODE_IMAGE_PY38", RAY_NODE_IMAGE),
"py39": os.environ.get("RAY_NODE_IMAGE_PY39", RAY_NODE_IMAGE),
"py310": os.environ.get("RAY_NODE_IMAGE_PY310", RAY_NODE_IMAGE),
}
RAY_CLUSTER_WORKER_REPLICAS = int(os.environ.get("RAY_CLUSTER_WORKER_REPLICAS", "1"))
RAY_CLUSTER_WORKER_REPLICAS_MAX = int(
os.environ.get("RAY_CLUSTER_WORKER_REPLICAS_MAX", "5")

0 comments on commit 626fb5f

Please sign in to comment.