From 58d63a8fdc6529d5f2be30fd5e8c5eb5e83f6336 Mon Sep 17 00:00:00 2001 From: tenzen-y Date: Sun, 11 Dec 2022 10:50:53 +0900 Subject: [PATCH] Upgrade python version to v3.10 Signed-off-by: tenzen-y --- .github/workflows/test-python.yaml | 8 +++++++- cmd/earlystopping/medianstop/v1beta1/Dockerfile | 2 +- .../v1beta1/tfevent-metricscollector/Dockerfile | 2 +- .../v1beta1/tfevent-metricscollector/requirements.txt | 2 +- cmd/suggestion/hyperband/v1beta1/Dockerfile | 2 +- cmd/suggestion/hyperopt/v1beta1/Dockerfile | 2 +- cmd/suggestion/nas/darts/v1beta1/Dockerfile | 2 +- cmd/suggestion/nas/enas/v1beta1/Dockerfile | 2 +- cmd/suggestion/optuna/v1beta1/Dockerfile | 2 +- cmd/suggestion/pbt/v1beta1/Dockerfile | 2 +- cmd/suggestion/skopt/v1beta1/Dockerfile | 2 +- docs/developer-guide.md | 2 +- .../v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu | 2 +- .../v1beta1/trial-images/enas-cnn-cifar10/Dockerfile.cpu | 2 +- examples/v1beta1/trial-images/mxnet-mnist/Dockerfile | 2 +- .../v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu | 2 +- examples/v1beta1/trial-images/simple-pbt/Dockerfile | 2 +- .../trial-images/tf-mnist-with-summaries/Dockerfile | 2 +- test/unit/v1beta1/requirements.txt | 2 +- test/unit/v1beta1/suggestion/test_chocolate_service.py | 7 ++++--- 20 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 074ea60e274..8e7ce751082 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -21,7 +21,13 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Run Python test run: make pytest + + # TODO (tenzen-y): Remove tests for Python 3.9 once we remove the Chocolate Suggestion Service from Katib. + strategy: + fail-fast: false + matrix: + python-version: ['3.9', '3.10'] diff --git a/cmd/earlystopping/medianstop/v1beta1/Dockerfile b/cmd/earlystopping/medianstop/v1beta1/Dockerfile index 1a5ebd35e2a..a32fbb06169 100644 --- a/cmd/earlystopping/medianstop/v1beta1/Dockerfile +++ b/cmd/earlystopping/medianstop/v1beta1/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile b/cmd/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile index c5ff6427ec3..9bb78fcdd75 100644 --- a/cmd/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile +++ b/cmd/metricscollector/v1beta1/tfevent-metricscollector/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/metricscollector/v1beta1/tfevent-metricscollector/requirements.txt b/cmd/metricscollector/v1beta1/tfevent-metricscollector/requirements.txt index 1303e71856f..4c6afaae49f 100644 --- a/cmd/metricscollector/v1beta1/tfevent-metricscollector/requirements.txt +++ b/cmd/metricscollector/v1beta1/tfevent-metricscollector/requirements.txt @@ -1,4 +1,4 @@ -psutil==5.8.0 +psutil==5.9.4 rfc3339>=6.2 grpcio==1.41.1 googleapis-common-protos==1.6.0 diff --git a/cmd/suggestion/hyperband/v1beta1/Dockerfile b/cmd/suggestion/hyperband/v1beta1/Dockerfile index c116991242b..2afceb05e9f 100644 --- a/cmd/suggestion/hyperband/v1beta1/Dockerfile +++ b/cmd/suggestion/hyperband/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/hyperopt/v1beta1/Dockerfile b/cmd/suggestion/hyperopt/v1beta1/Dockerfile index 2324c12753c..9c7bc2e6bf2 100644 --- a/cmd/suggestion/hyperopt/v1beta1/Dockerfile +++ b/cmd/suggestion/hyperopt/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/nas/darts/v1beta1/Dockerfile b/cmd/suggestion/nas/darts/v1beta1/Dockerfile index e94341f0779..9f26214a3ca 100644 --- a/cmd/suggestion/nas/darts/v1beta1/Dockerfile +++ b/cmd/suggestion/nas/darts/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/nas/enas/v1beta1/Dockerfile b/cmd/suggestion/nas/enas/v1beta1/Dockerfile index 639d21b2750..8b12354ee32 100644 --- a/cmd/suggestion/nas/enas/v1beta1/Dockerfile +++ b/cmd/suggestion/nas/enas/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/optuna/v1beta1/Dockerfile b/cmd/suggestion/optuna/v1beta1/Dockerfile index 7b7129f7f44..9105b54d5dc 100644 --- a/cmd/suggestion/optuna/v1beta1/Dockerfile +++ b/cmd/suggestion/optuna/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/pbt/v1beta1/Dockerfile b/cmd/suggestion/pbt/v1beta1/Dockerfile index e969ee39c21..795cdf009cb 100644 --- a/cmd/suggestion/pbt/v1beta1/Dockerfile +++ b/cmd/suggestion/pbt/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/cmd/suggestion/skopt/v1beta1/Dockerfile b/cmd/suggestion/skopt/v1beta1/Dockerfile index a0f934fafbf..c6d71b534b9 100644 --- a/cmd/suggestion/skopt/v1beta1/Dockerfile +++ b/cmd/suggestion/skopt/v1beta1/Dockerfile @@ -6,7 +6,7 @@ ENV GRPC_HEALTH_PROBE_VERSION v0.4.11 RUN wget -qO /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} \ && chmod +x /bin/grpc_health_probe -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/katib diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 183e4fd99b6..f1fad64585d 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -16,7 +16,7 @@ see the following user guides: - [Docker](https://docs.docker.com/) (20.10 or later) - [Docker Buildx](https://docs.docker.com/build/buildx/) (0.8.0 or later) - [Java](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html) (8 or later) -- [Python](https://www.python.org/) (3.9 or later) +- [Python](https://www.python.org/) (3.10 or later) - [kustomize](https://kustomize.io/) (4.0.5 or later) ## Build from source code diff --git a/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu b/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu index 067628cf06e..7437e1867bd 100644 --- a/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu +++ b/examples/v1beta1/trial-images/darts-cnn-cifar10/Dockerfile.cpu @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ENV TARGET_DIR /opt/darts-cnn-cifar10 diff --git a/examples/v1beta1/trial-images/enas-cnn-cifar10/Dockerfile.cpu b/examples/v1beta1/trial-images/enas-cnn-cifar10/Dockerfile.cpu index c2cdb993edd..b5933d60a81 100644 --- a/examples/v1beta1/trial-images/enas-cnn-cifar10/Dockerfile.cpu +++ b/examples/v1beta1/trial-images/enas-cnn-cifar10/Dockerfile.cpu @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV TARGET_DIR /opt/enas-cnn-cifar10 diff --git a/examples/v1beta1/trial-images/mxnet-mnist/Dockerfile b/examples/v1beta1/trial-images/mxnet-mnist/Dockerfile index d19c1aac175..6dce6a685bb 100644 --- a/examples/v1beta1/trial-images/mxnet-mnist/Dockerfile +++ b/examples/v1beta1/trial-images/mxnet-mnist/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/arm/armpl_22.0.2_gcc-11.2/lib" diff --git a/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu b/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu index 1ebab4fa036..5fef0094386 100644 --- a/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu +++ b/examples/v1beta1/trial-images/pytorch-mnist/Dockerfile.cpu @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ADD examples/v1beta1/trial-images/pytorch-mnist /opt/pytorch-mnist diff --git a/examples/v1beta1/trial-images/simple-pbt/Dockerfile b/examples/v1beta1/trial-images/simple-pbt/Dockerfile index f7285447c14..b05de3d35e3 100644 --- a/examples/v1beta1/trial-images/simple-pbt/Dockerfile +++ b/examples/v1beta1/trial-images/simple-pbt/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ADD examples/v1beta1/trial-images/simple-pbt /opt/pbt diff --git a/examples/v1beta1/trial-images/tf-mnist-with-summaries/Dockerfile b/examples/v1beta1/trial-images/tf-mnist-with-summaries/Dockerfile index c34b660f23a..f589dd4608f 100644 --- a/examples/v1beta1/trial-images/tf-mnist-with-summaries/Dockerfile +++ b/examples/v1beta1/trial-images/tf-mnist-with-summaries/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-slim +FROM python:3.10-slim ARG TARGETARCH diff --git a/test/unit/v1beta1/requirements.txt b/test/unit/v1beta1/requirements.txt index 06604d58cf1..2aa91b337e3 100644 --- a/test/unit/v1beta1/requirements.txt +++ b/test/unit/v1beta1/requirements.txt @@ -1,2 +1,2 @@ grpcio-testing==1.41.1 -pytest==5.1.2 +pytest==7.2.0 diff --git a/test/unit/v1beta1/suggestion/test_chocolate_service.py b/test/unit/v1beta1/suggestion/test_chocolate_service.py index 34809f4863f..c142d974fb5 100644 --- a/test/unit/v1beta1/suggestion/test_chocolate_service.py +++ b/test/unit/v1beta1/suggestion/test_chocolate_service.py @@ -13,19 +13,20 @@ # limitations under the License. import os - +import sys import grpc import grpc_testing import unittest import pytest from pkg.apis.manager.v1beta1.python import api_pb2 - -from pkg.suggestion.v1beta1.chocolate.service import ChocolateService +if sys.version_info <= (3, 9): + from pkg.suggestion.v1beta1.chocolate.service import ChocolateService import utils +@unittest.skipIf(sys.version_info >= (3, 10), reason="Chocolate supports only Python 3.9 or lower") class TestChocolate(unittest.TestCase): def setUp(self): servicers = {