Skip to content

Commit

Permalink
remove ability to set python_version
Browse files Browse the repository at this point in the history
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
  • Loading branch information
psschwei committed Jul 24, 2024
1 parent 3e464c1 commit b80ac57
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 69 deletions.
12 changes: 0 additions & 12 deletions .github/actions/icr-build-and-push-images/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Build and push image with Python Version
if: ${{inputs.pythonversion}} != ''
uses: docker/build-push-action@v5
with:
platforms: ${{inputs.platforms}}
context: .
file: ${{inputs.dockerfile}}
push: true
tags: ${{inputs.repository}}/${{inputs.name}}:${{inputs.tag}}-${{inputs.pythonversion}},${{inputs.repository}}/${{inputs.name}}:latest-${{inputs.pythonversion}}
build-args:
IMAGE_PY_VERSION=${{inputs.pythonversion}}
- name: Build and push image
if: ${{inputs.pythonversion}} == ''
uses: docker/build-push-action@v5
with:
platforms: ${{inputs.platforms}}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/icr-image-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,12 @@ jobs:
matrix:
include:
- imagename: qiskit-serverless/ray-node
pythonversion: py39
dockerfile: Dockerfile-ray-node
platforms: linux/amd64
- imagename: qiskit-serverless/ray-node
pythonversion: py310
dockerfile: Dockerfile-ray-node
platforms: linux/amd64,linux/arm64
- imagename: qiskit-serverless/ray-node
pythonversion: py311
dockerfile: Dockerfile-ray-node
platforms: linux/amd64,linux/arm64
- imagename: qiskit-serverless/gateway
pythonversion: ''
dockerfile: ./gateway/Dockerfile
platforms: linux/amd64,linux/arm64
- imagename: qiskit-serverless/proxy
pythonversion: ''
dockerfile: ./proxy/Dockerfile
platforms: linux/amd64,linux/arm64
steps:
Expand All @@ -58,7 +47,6 @@ jobs:
name: ${{ matrix.imagename }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
pythonversion: ${{ matrix.pythonversion }}
- name: Set version from tag
if : github.event_name == 'release' && github.event.action == 'published'
id: set-version-from-tag
Expand All @@ -71,4 +59,3 @@ jobs:
name: ${{ matrix.imagename }}
dockerfile: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
pythonversion: ${{ matrix.pythonversion }}
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ push-all: push-ray-node push-gateway push-proxy

build-ray-node:
docker build -t $(rayNodeImageName):$(version) --build-arg TARGETARCH=$(arch) -f Dockerfile-ray-node .
docker build -t $(rayNodeImageName):$(version)-py310 --build-arg TARGETARCH=$(arch) --build-arg IMAGE_PY_VERSION=py310 -f Dockerfile-ray-node .
docker build -t $(rayNodeImageName):$(version)-py39 --build-arg TARGETARCH=$(arch) --build-arg IMAGE_PY_VERSION=py39 -f Dockerfile-ray-node .

build-gateway:
docker build -t $(gatewayImageName):$(version) -f ./gateway/Dockerfile .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ spec:
value: {{ .Release.Namespace }}
- name: RAY_NODE_IMAGE
value: {{ .Values.application.ray.nodeImage | 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
Expand Down
6 changes: 2 additions & 4 deletions charts/qiskit-serverless/charts/gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ application:
superuser:
enable: true
ray:
nodeImage: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0-py39"
nodeImage_py39: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0-py39"
nodeImage_py310: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0-py310"
nodeImage: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0"
cpu: 2
memory: 2
replicas: 1
minReplicas: 1
maxReplicas: 4
opensslImage: registry.access.redhat.com/ubi8/openssl:8.8-9
kubectlImage: alpine/k8s:1.29.2@sha256:a51aa37f0a34ff827c7f2f9cb7f6fbb8f0e290fa625341be14c2fcc4b1880f60
proxyImage: "icr.io/quantum-public/qiskit-serverless/proxy:0.9.0"
proxyImage: "icr.io/quantum-public/qiskit-serverless/proxy:0.14.0"
scrapeWithPrometheus: true
openTelemetry: false
openTelemetryCollector:
Expand Down
2 changes: 1 addition & 1 deletion charts/qiskit-serverless/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ gateway:
type: ClusterIP
port: 8000
ray:
nodeImage: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0-py311"
nodeImage: "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0"
opensslImage: registry.access.redhat.com/ubi8/openssl:8.8-9
kubectlImage: alpine/k8s:1.29.2@sha256:a51aa37f0a34ff827c7f2f9cb7f6fbb8f0e290fa625341be14c2fcc4b1880f60
limits:
Expand Down
4 changes: 0 additions & 4 deletions client/qiskit_serverless/core/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,12 @@ class Configuration: # pylint: disable=too-many-instance-attributes
auto_scaling: set True to enable auto scating of the workers
min_workers: minimum number of workers when auto scaling is enabled
max_workers: maxmum number of workers when auto scaling is enabled
python_version: python version string of program execution worker node
"""

workers: Optional[int] = None
min_workers: Optional[int] = None
max_workers: Optional[int] = None
auto_scaling: Optional[bool] = False
python_version: Optional[str] = ""
PYTHON_V3_9 = "py39"
PYTHON_V3_10 = "py310"


class BaseJobClient:
Expand Down
28 changes: 28 additions & 0 deletions gateway/api/migrations/0027_alter_jobconfig_python_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0.7 on 2024-07-24 14:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("api", "0026_merge_20240613_1848"),
]

operations = [
migrations.AlterField(
model_name="jobconfig",
name="python_version",
field=models.CharField(
blank=True,
choices=[
("py38", "Version 3.8"),
("py39", "Version 3.9"),
("py310", "Version 3.10"),
("py311", "Version 3.11"),
],
max_length=6,
null=True,
),
),
]
2 changes: 2 additions & 0 deletions gateway/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ class JobConfig(models.Model):
PYTHON_V3_8 = "py38"
PYTHON_V3_9 = "py39"
PYTHON_V3_10 = "py310"
PYTHON_V3_11 = "py311"
PYTHON_VERSIONS = [
(PYTHON_V3_8, "Version 3.8"),
(PYTHON_V3_9, "Version 3.9"),
(PYTHON_V3_10, "Version 3.10"),
(PYTHON_V3_11, "Version 3.11"),
]
python_version = models.CharField(
max_length=6,
Expand Down
15 changes: 1 addition & 14 deletions gateway/api/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,7 @@ def create_ray_cluster(
job_config.max_workers = settings.RAY_CLUSTER_WORKER_MAX_REPLICAS
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 = "default"

if job_config.python_version in settings.RAY_NODE_IMAGES_MAP:
node_image = settings.RAY_NODE_IMAGES_MAP[job_config.python_version]
else:
message = (
f"Specified python version {job_config.python_version} "
"not in a list of supported python versions "
f"{list(settings.RAY_NODE_IMAGES_MAP.keys())}. "
"Default image will be used instead."
)
logger.warning(message)
node_image = settings.RAY_NODE_IMAGE
node_image = settings.RAY_NODE_IMAGE

# if user specified image use specified image
if job.program.image is not None:
Expand Down
9 changes: 0 additions & 9 deletions gateway/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,6 @@ class Meta:
auto_scaling = serializers.BooleanField(
default=False, required=False, allow_null=True
)
python_version = serializers.ChoiceField(
choices=(
("py39", "Version 3.9"),
("py310", "Version 3.10"),
),
required=False,
allow_null=True,
allow_blank=True,
)


class ProgramSerializer(serializers.ModelSerializer):
Expand Down
7 changes: 1 addition & 6 deletions gateway/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,8 @@
),
}
RAY_NODE_IMAGE = os.environ.get(
"RAY_NODE_IMAGE", "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0-py310"
"RAY_NODE_IMAGE", "icr.io/quantum-public/qiskit-serverless/ray-node:0.14.0"
)
RAY_NODE_IMAGES_MAP = {
"default": 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")
Expand Down

0 comments on commit b80ac57

Please sign in to comment.