Skip to content

Commit

Permalink
Merge pull request #272 from sthaha/upgrade-py-3.10
Browse files Browse the repository at this point in the history
chore(python): upgrade to 3.10
  • Loading branch information
sthaha authored Jul 4, 2024
2 parents 388d11d + 4941251 commit 3ee5a71
Show file tree
Hide file tree
Showing 26 changed files with 56 additions and 56 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ exec-test:

test-pipeline:
mkdir -p ${MODEL_PATH}
$(CTR_CMD) run --platform linux/amd64 -v ${MODEL_PATH}:/mnt/models -i $(TEST_IMAGE) /bin/bash -c "python3.8 -u ./tests/pipeline_test.py"
$(CTR_CMD) run --platform linux/amd64 -v ${MODEL_PATH}:/mnt/models -i $(TEST_IMAGE) /bin/bash -c "python3.10 -u ./tests/pipeline_test.py"

# test collector --> estimator
run-estimator:
$(CTR_CMD) run -d --platform linux/amd64 -e "MODEL_TOPURL=http://localhost:8110" -v ${MODEL_PATH}:/mnt/models -p 8100:8100 --name estimator $(TEST_IMAGE) /bin/bash -c "python3.8 tests/http_server.py & sleep 5 && python3.8 src/estimate/estimator.py"
$(CTR_CMD) run -d --platform linux/amd64 -e "MODEL_TOPURL=http://localhost:8110" -v ${MODEL_PATH}:/mnt/models -p 8100:8100 --name estimator $(TEST_IMAGE) /bin/bash -c "python3.10 tests/http_server.py & sleep 5 && python3.10 src/estimate/estimator.py"

run-collector-client:
$(CTR_CMD) exec estimator /bin/bash -c "while [ ! -S "/tmp/estimator.sock" ]; do sleep 1; done; python3.8 -u ./tests/estimator_power_request_test.py"
$(CTR_CMD) exec estimator /bin/bash -c "while [ ! -S "/tmp/estimator.sock" ]; do sleep 1; done; python3.10 -u ./tests/estimator_power_request_test.py"

clean-estimator:
$(CTR_CMD) stop estimator
Expand All @@ -48,11 +48,11 @@ test-estimator: run-estimator run-collector-client clean-estimator

# test estimator --> model-server
run-model-server:
$(CTR_CMD) run -d --platform linux/amd64 -e "MODEL_TOPURL=http://localhost:8110" -v ${MODEL_PATH}:/mnt/models -p 8100:8100 --name model-server $(TEST_IMAGE) /bin/bash -c "python3.8 tests/http_server.py & sleep 10 && python3.8 src/server/model_server.py"
$(CTR_CMD) run -d --platform linux/amd64 -e "MODEL_TOPURL=http://localhost:8110" -v ${MODEL_PATH}:/mnt/models -p 8100:8100 --name model-server $(TEST_IMAGE) /bin/bash -c "python3.10 tests/http_server.py & sleep 10 && python3.10 src/server/model_server.py"
while ! docker logs model-server | grep -q Serving; do echo "waiting for model-server to serve"; sleep 5; done

run-estimator-client:
$(CTR_CMD) exec model-server /bin/bash -c "python3.8 -u ./tests/estimator_model_request_test.py"
$(CTR_CMD) exec model-server /bin/bash -c "python3.10 -u ./tests/estimator_model_request_test.py"

clean-model-server:
@$(CTR_CMD) stop model-server
Expand All @@ -62,11 +62,11 @@ test-model-server: run-model-server run-estimator-client clean-model-server

# test offline trainer
run-offline-trainer:
$(CTR_CMD) run -d --platform linux/amd64 -p 8102:8102 --name offline-trainer $(TEST_IMAGE) python3.8 src/train/offline_trainer.py
$(CTR_CMD) run -d --platform linux/amd64 -p 8102:8102 --name offline-trainer $(TEST_IMAGE) python3.10 src/train/offline_trainer.py
sleep 5

run-offline-trainer-client:
$(CTR_CMD) exec offline-trainer /bin/bash -c "python3.8 -u ./tests/offline_trainer_test.py"
$(CTR_CMD) exec offline-trainer /bin/bash -c "python3.10 -u ./tests/offline_trainer_test.py"

clean-offline-trainer:
@$(CTR_CMD) stop offline-trainer
Expand Down Expand Up @@ -112,4 +112,4 @@ patch-power-request-client:
kubectl patch ds kepler-exporter -n kepler --patch-file ./manifests/test/power-request-client.yaml

patch-model-request-client:
kubectl patch ds kepler-exporter -n kepler --patch-file ./manifests/test/model-request-client.yaml
kubectl patch ds kepler-exporter -n kepler --patch-file ./manifests/test/model-request-client.yaml
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ EXPOSE 8101
# port for Offline Trainer
EXPOSE 8102

ENTRYPOINT ["python3.8", "cmd/main.py"]
ENTRYPOINT ["python3.10", "cmd/main.py"]
4 changes: 2 additions & 2 deletions dockerfiles/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM python:3.8-slim
FROM python:3.10-slim
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ EXPOSE 8101
# port for Offline Trainer
EXPOSE 8102

CMD [ "python3.8", "-u", "src/server/model_server.py" ]
CMD [ "python3.10", "-u", "src/server/model_server.py" ]
4 changes: 2 additions & 2 deletions dockerfiles/Dockerfile.test-nobase
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Include base requirements
FROM python:3.8-slim
FROM python:3.10-slim
COPY dockerfiles/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

Expand All @@ -25,4 +25,4 @@ EXPOSE 8101
# port for Offline Trainer
EXPOSE 8102

CMD [ "python3.8", "-u", "src/server/model_server.py" ]
CMD [ "python3.10", "-u", "src/server/model_server.py" ]
4 changes: 2 additions & 2 deletions manifests/base/patch/patch-estimator-sidecar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
name: kepler-exporter
- image: kepler_model_server
imagePullPolicy: IfNotPresent
command: [ "python3.8" ]
command: [ "python3.10" ]
args: ["-u", "src/estimate/estimator.py" ]
name: estimator
volumeMounts:
Expand All @@ -45,4 +45,4 @@ spec:
- emptyDir: {}
name: tmp
- emptyDir: {}
name: mnt
name: mnt
4 changes: 2 additions & 2 deletions manifests/offline-trainer/offline-trainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- name: mnt
mountPath: /mnt
readOnly: false
command: [ "python3.8" ]
command: [ "python3.10" ]
args: ["-u", "src/train/offline_trainer.py" ]

---
Expand All @@ -58,4 +58,4 @@ spec:
ports:
- name: http
port: 8102
targetPort: http
targetPort: http
2 changes: 1 addition & 1 deletion manifests/server/online-train/patch-trainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ spec:
- name: mnt
mountPath: /mnt
readOnly: false
command: [ "python3.8" ]
command: [ "python3.10" ]
args: ["-u", "src/train/online_trainer.py" ]
4 changes: 2 additions & 2 deletions manifests/server/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
- name: mnt
mountPath: /mnt
readOnly: false
command: [ "python3.8" ]
command: [ "python3.10" ]
args: ["-u", "src/server/model_server.py" ]
---
kind: Service
Expand All @@ -63,4 +63,4 @@ spec:
ports:
- name: http
port: 8100
targetPort: http
targetPort: http
6 changes: 3 additions & 3 deletions manifests/test/file-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
image: localhost:5001/kepler_model_server:devel-test
imagePullPolicy: IfNotPresent
command: [ "/bin/sh" ]
args: ["-c", "python3.8 -u tests/http_server.py"]
args: ["-c", "python3.10 -u tests/http_server.py"]
ports:
- containerPort: 8110
name: http
Expand All @@ -23,7 +23,7 @@ spec:
image: localhost:5001/kepler_model_server:devel-test
imagePullPolicy: IfNotPresent
command: [ "/bin/sh" ]
args: ["-c", "python3.8 -u tests/minimal_trainer.py"]
args: ["-c", "python3.10 -u tests/minimal_trainer.py"]
volumeMounts:
- name: mnt
mountPath: /mnt
Expand All @@ -46,4 +46,4 @@ spec:
ports:
- name: http
port: 8110
targetPort: http
targetPort: http
2 changes: 1 addition & 1 deletion manifests/test/model-request-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
image: localhost:5001/kepler_model_server:devel-test
imagePullPolicy: IfNotPresent
command: [ "/bin/sh" ]
args: ["-c", "python3.8 -u tests/weight_model_request_test.py && echo Done && sleep infinity"]
args: ["-c", "python3.10 -u tests/weight_model_request_test.py && echo Done && sleep infinity"]
volumeMounts:
- name: cfm
mountPath: /etc/kepler/kepler.config
Expand Down
2 changes: 1 addition & 1 deletion manifests/test/power-request-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
image: localhost:5001/kepler_model_server:devel-test
imagePullPolicy: IfNotPresent
command: [ "/bin/sh" ]
args: ["-c", "until [ -e /tmp/estimator.sock ]; do sleep 1; done && python3.8 -u tests/estimator_power_request_test.py && echo Done && sleep infinity"]
args: ["-c", "until [ -e /tmp/estimator.sock ]; do sleep 1; done && python3.10 -u tests/estimator_power_request_test.py && echo Done && sleep infinity"]
volumeMounts:
- name: cfm
mountPath: /etc/kepler/kepler.config
Expand Down
2 changes: 1 addition & 1 deletion model_training/s3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY . /usr/local

RUN pip install boto3 ibm-cos-sdk

ENTRYPOINT ["python3.8"]
ENTRYPOINT ["python3.10"]
6 changes: 3 additions & 3 deletions model_training/tekton/pipelines/collect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spec:
- --benchmark=idle
- -o=idle
- --id=$(params.MACHINE_ID)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -151,7 +151,7 @@ spec:
- --id=$(params.MACHINE_ID)
- --benchmark=stressng
- -o=kepler_query
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -190,4 +190,4 @@ spec:
- name: MACHINE_ID
value: $(params.MACHINE_ID)
taskRef:
name: aws-s3-push
name: aws-s3-push
6 changes: 3 additions & 3 deletions model_training/tekton/pipelines/complete-train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
- --benchmark=idle
- -o=idle
- --id=$(params.MACHINE_ID)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -167,7 +167,7 @@ spec:
- --benchmark=stressng
- -o=kepler_query
- --id=$(params.MACHINE_ID)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -231,4 +231,4 @@ spec:
- name: MACHINE_ID
value: $(params.MACHINE_ID)
taskRef:
name: aws-s3-push
name: aws-s3-push
6 changes: 3 additions & 3 deletions model_training/tekton/pipelines/single-train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ spec:
- --benchmark=idle
- -o=idle
- --id=$(params.MACHINE_ID)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -175,7 +175,7 @@ spec:
- --benchmark=stressng
- -o=kepler_query
- --id=$(params.MACHINE_ID)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: PROM_SERVER
value: http://prometheus-k8s.monitoring.svc:9090
Expand Down Expand Up @@ -323,4 +323,4 @@ spec:
- name: MACHINE_ID
value: $(params.MACHINE_ID)
taskRef:
name: aws-s3-push
name: aws-s3-push
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/extract-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
steps:
- name: extract
image: $(params.MODEL_SERVER_IMAGE)
command: ["python3.8"]
command: ["python3.10"]
args:
- cmd/main.py
- extract
Expand All @@ -48,4 +48,4 @@ spec:
- --feature-group=$(params.FEATURE_GROUP)
- --energy-source=$(params.ENERGY_SOURCE)
- --output-type=$(params.OUTPUT_TYPE)
- --thirdparty-metrics="$(params.THIRDPARTY_METRICS)"
- --thirdparty-metrics="$(params.THIRDPARTY_METRICS)"
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/isolate-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
steps:
- name: isolate
image: $(params.MODEL_SERVER_IMAGE)
command: ["python3.8"]
command: ["python3.10"]
args:
- cmd/main.py
- isolate
Expand All @@ -64,4 +64,4 @@ spec:
- --abs-pipeline-name=$(params.ABS_PIPELINE_NAME)
- --profile=idle
- --target-hints="$(params.TARGET_HINTS)"
- --bg-hints="$(params.BG_HINTS)"
- --bg-hints="$(params.BG_HINTS)"
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/original-pipeline-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
steps:
- name: pipeline-train
image: $(params.MODEL_SERVER_IMAGE)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: MODEL_PATH
value: $(workspaces.mnt.path)/models
Expand All @@ -68,4 +68,4 @@ spec:
- --dyn-trainers=$(params.DYN_TRAINERS)
- --energy-source=$(params.ENERGY_SOURCE)
- --thirdparty-metrics="$(params.THIRDPARTY_METRICS)"
- --id=$(params.MACHINE_ID)
- --id=$(params.MACHINE_ID)
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/s3/aws-s3-load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
secretKeyRef:
name: $(params.COS_SECRET_NAME)
key: bucketName
command: ["python3.8"]
command: ["python3.10"]
args:
- s3-loader.py
- aws
Expand All @@ -55,4 +55,4 @@ spec:
- --bucket-name=$(BUCKET_NAME)
- --mnt-path=$(workspaces.mnt.path)
- --pipeline-name=$(params.PIPELINE_NAME)
- --machine-id=$(params.MACHINE_ID)
- --machine-id=$(params.MACHINE_ID)
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/s3/aws-s3-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
secretKeyRef:
name: $(params.COS_SECRET_NAME)
key: bucketName
command: ["python3.8"]
command: ["python3.10"]
args:
- s3-pusher.py
- aws
Expand All @@ -53,4 +53,4 @@ spec:
- --mnt-path=$(workspaces.mnt.path)
- --query-data=kepler_query
- --idle-data=idle
- --machine-id=$(params.MACHINE_ID)
- --machine-id=$(params.MACHINE_ID)
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/s3/ibmcloud-s3-load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
secretKeyRef:
name: $(params.COS_SECRET_NAME)
key: bucketName
command: ["python3.8"]
command: ["python3.10"]
args:
- s3-loader.py
- ibmcloud
Expand All @@ -55,4 +55,4 @@ spec:
- --bucket-name=$(BUCKET_NAME)
- --mnt-path=$(workspaces.mnt.path)
- --pipeline-name=$(params.PIPELINE_NAME)
- --machine-id=$(params.MACHINE_ID)
- --machine-id=$(params.MACHINE_ID)
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/s3/ibmcloud-s3-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
secretKeyRef:
name: $(params.COS_SECRET_NAME)
key: bucketName
command: ["python3.8"]
command: ["python3.10"]
args:
- s3-pusher.py
- ibmcloud
Expand All @@ -53,4 +53,4 @@ spec:
- --mnt-path=$(workspaces.mnt.path)
- --query-data=kepler_query
- --idle-data=idle
- --machine-id=$(params.MACHINE_ID)
- --machine-id=$(params.MACHINE_ID)
4 changes: 2 additions & 2 deletions model_training/tekton/tasks/train-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
steps:
- name: train-from-data
image: $(params.MODEL_SERVER_IMAGE)
command: ["python3.8"]
command: ["python3.10"]
env:
- name: MODEL_PATH
value: $(workspaces.mnt.path)/models
Expand All @@ -58,4 +58,4 @@ spec:
- --output-type=$(params.OUTPUT_TYPE)
- --trainers=$(params.TRAINERS)
- --thirdparty-metrics="$(params.THIRDPARTY_METRICS)"
- --id=$(params.MACHINE_ID)
- --id=$(params.MACHINE_ID)
Loading

0 comments on commit 3ee5a71

Please sign in to comment.