From 8e7feb16e1ba01df19e05e91ace934f65b68274f Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Fri, 3 Feb 2023 15:31:55 +0800 Subject: [PATCH 1/9] auto detect py version --- python/xorbits/compat/__init__.py | 13 +++++++++++++ python/xorbits/compat/_constants.py | 15 +++++++++++++++ python/xorbits/deploy/kubernetes/client.py | 10 ++++++++++ python/xorbits/deploy/kubernetes/config.py | 10 ++++++++-- .../deploy/kubernetes/tests/test_kubernetes.py | 4 ++-- python/xorbits/utils.py | 8 ++++++++ 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 python/xorbits/compat/__init__.py create mode 100644 python/xorbits/compat/_constants.py diff --git a/python/xorbits/compat/__init__.py b/python/xorbits/compat/__init__.py new file mode 100644 index 000000000..37f6558d9 --- /dev/null +++ b/python/xorbits/compat/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2022-2023 XProbe Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/python/xorbits/compat/_constants.py b/python/xorbits/compat/_constants.py new file mode 100644 index 000000000..d80efb459 --- /dev/null +++ b/python/xorbits/compat/_constants.py @@ -0,0 +1,15 @@ +# Copyright 2022-2023 XProbe Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SUPPORTED_PY_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] diff --git a/python/xorbits/deploy/kubernetes/client.py b/python/xorbits/deploy/kubernetes/client.py index 35a439074..f9996c3b0 100644 --- a/python/xorbits/deploy/kubernetes/client.py +++ b/python/xorbits/deploy/kubernetes/client.py @@ -24,6 +24,8 @@ from ..._mars.services.cluster.api import WebClusterAPI from ..._mars.session import new_session from ..._mars.utils import calc_size_by_str +from ...compat._constants import SUPPORTED_PY_VERSIONS +from ...utils import get_local_py_version from .config import ( IngressConfig, NamespaceConfig, @@ -117,6 +119,14 @@ def __init__( raise TypeError("`pip` must be str or List[str] type.") if conda is not None and not isinstance(conda, (str, list)): # pragma: no cover raise TypeError("`conda` must be str or List[str] type.") + local_py_version = get_local_py_version() + if ( + image is None and local_py_version not in SUPPORTED_PY_VERSIONS + ): # pragma: no cover + raise RuntimeError( + f"Xorbits does not support Kubernetes deployment under your python version {local_py_version}. " + f"Please change the python version to one of the following versions: {SUPPORTED_PY_VERSIONS}." + ) self._api_client = kube_api_client self._core_api = kube_client.CoreV1Api(kube_api_client) diff --git a/python/xorbits/deploy/kubernetes/config.py b/python/xorbits/deploy/kubernetes/config.py index f19b9d8ba..9d74ce1e5 100644 --- a/python/xorbits/deploy/kubernetes/config.py +++ b/python/xorbits/deploy/kubernetes/config.py @@ -21,13 +21,13 @@ from ... import __version__ from ..._mars.utils import calc_size_by_str, parse_readable_size +from ...utils import get_local_py_version try: from kubernetes.client import ApiClient except ImportError: # pragma: no cover ApiClient = None -DEFAULT_IMAGE = "xprobe/xorbits:v" + __version__ DEFAULT_WORKER_CACHE_MEM = "40%" @@ -651,7 +651,7 @@ def __init__( super().__init__( self.rc_name, - image or DEFAULT_IMAGE, + image or self.get_default_image(), replicas, resource_request=req_res, resource_limit=limit_res if limit_resources else None, @@ -667,6 +667,12 @@ def __init__( self.add_labels({"xorbits/service-type": self.rc_name}) + @staticmethod + def get_default_image(): + image = "xprobe/xorbits:v" + __version__ + image += f"-py{get_local_py_version()}" + return image + def add_default_envs(self): self.add_env("MARS_K8S_POD_NAME", field_path="metadata.name") self.add_env("MARS_K8S_POD_NAMESPACE", field_path="metadata.namespace") diff --git a/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py b/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py index d2d7d219c..8f6ee287a 100644 --- a/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py +++ b/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py @@ -17,7 +17,6 @@ import os import shutil import subprocess -import sys import tempfile import uuid from contextlib import contextmanager @@ -28,6 +27,7 @@ from .... import numpy as xnp from ...._mars.utils import lazy_import +from ....utils import get_local_py_version from .. import new_cluster k8s = lazy_import("kubernetes") @@ -133,7 +133,7 @@ def _load_docker_env(): @contextmanager def _start_kube_cluster(**kwargs): - py_version = str(sys.version_info.major) + "." + str(sys.version_info.minor) + py_version = get_local_py_version() _load_docker_env() image_name = _build_docker_images(py_version) diff --git a/python/xorbits/utils.py b/python/xorbits/utils.py index ffa524323..95d414e99 100644 --- a/python/xorbits/utils.py +++ b/python/xorbits/utils.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import traceback from typing import Callable @@ -33,3 +34,10 @@ def inn(self, *args, **kwargs): return f(self, *args, **kwargs) return inn + + +def get_local_py_version(): + """ + Get the python version on the machine where Xorbits is installed, formatted by "major.minor", like "3.10" + """ + return str(sys.version_info.major) + "." + str(sys.version_info.minor) From fade3771f59e95e263ba0cd87b33176bb05447cc Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Fri, 3 Feb 2023 17:29:26 +0800 Subject: [PATCH 2/9] install compatible packages --- python/xorbits/compat/_constants.py | 3 +++ python/xorbits/deploy/docker/install.sh | 9 +++++++++ python/xorbits/deploy/kubernetes/config.py | 20 +++++++++++++++++++- python/xorbits/utils.py | 13 ++++++++++++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/python/xorbits/compat/_constants.py b/python/xorbits/compat/_constants.py index d80efb459..1d37c4377 100644 --- a/python/xorbits/compat/_constants.py +++ b/python/xorbits/compat/_constants.py @@ -13,3 +13,6 @@ # limitations under the License. SUPPORTED_PY_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] + +# Packages that require the compatible version between local and cluster +COMPATIBLE_DEPS = ["cloudpickle", "numpy", "pandas"] diff --git a/python/xorbits/deploy/docker/install.sh b/python/xorbits/deploy/docker/install.sh index b689a8263..126ab6e7a 100644 --- a/python/xorbits/deploy/docker/install.sh +++ b/python/xorbits/deploy/docker/install.sh @@ -20,6 +20,15 @@ elif [ "$source" == "conda_yaml" ]; then touch /srv/conda/env.yaml echo "$content" > /srv/conda/env.yaml conda env update --name base --file /srv/conda/env.yaml +elif [ "$source" == "pip_compatible" ]; then + pip install --upgrade pip + mkdir -p /srv/pip_compatible + touch /srv/pip_compatible/requirements.txt + echo "$content" > /srv/pip_compatible/requirements.txt + pip install -r /srv/pip_compatible/requirements.txt --retries 3 > /srv/pip_compatible/logs.txt 2>&1 + if [ $? -eq 0 ]; then + echo "Succeed to install some version-sensitive packages." + fi else echo "There are no extra packages to install." fi diff --git a/python/xorbits/deploy/kubernetes/config.py b/python/xorbits/deploy/kubernetes/config.py index 9d74ce1e5..c1149cec0 100644 --- a/python/xorbits/deploy/kubernetes/config.py +++ b/python/xorbits/deploy/kubernetes/config.py @@ -21,7 +21,8 @@ from ... import __version__ from ..._mars.utils import calc_size_by_str, parse_readable_size -from ...utils import get_local_py_version +from ...compat._constants import COMPATIBLE_DEPS +from ...utils import get_local_package_version, get_local_py_version try: from kubernetes.client import ApiClient @@ -524,6 +525,15 @@ def get_install_content(source: Union[str, List[str]]) -> str: content = "\n".join(source) return content + @staticmethod + def get_compatible_packages() -> List[str]: + deps = [] + for dep in COMPATIBLE_DEPS: + version = get_local_package_version(dep) + if version is not None: + deps.append(f"{dep}=={version}") + return deps + @abc.abstractmethod def build_container_command(self) -> List: """Output container command""" @@ -531,6 +541,14 @@ def build_container_command(self) -> List: # All install contents must be wrapped in double quotes to ensure the correctness # when passing to the shell script. # At the same time, each command is followed by a semicolon to separate the individual commands. + deps = self.get_compatible_packages() + if deps: + # Install for consistent packages must be at the top of all commands. + # This does not affect user behavior. + cmd += ( + f'/srv/install.sh pip_compatible "{self.get_install_content(deps)}" ; ' + ) + if self._pip is not None: cmd += f'/srv/install.sh pip "{self.get_install_content(self._pip)}" ; ' if self._conda is not None: diff --git a/python/xorbits/utils.py b/python/xorbits/utils.py index 95d414e99..4dfd357c1 100644 --- a/python/xorbits/utils.py +++ b/python/xorbits/utils.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +import importlib import sys import traceback -from typing import Callable +from typing import Callable, Optional def is_pydev_evaluating_value() -> bool: @@ -41,3 +42,13 @@ def get_local_py_version(): Get the python version on the machine where Xorbits is installed, formatted by "major.minor", like "3.10" """ return str(sys.version_info.major) + "." + str(sys.version_info.minor) + + +def get_local_package_version(package_name: str) -> Optional[str]: + """ + Get the version of a python package. If the package is not installed, return None + """ + try: + return importlib.import_module(package_name).__version__ + except ModuleNotFoundError: + return None From b31de4051fc1b1c664232d339496d74507631060 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Mon, 6 Feb 2023 15:24:17 +0800 Subject: [PATCH 3/9] change startupProbe to exec way --- .../xorbits/deploy/kubernetes/_constants.py | 15 ++++++++ python/xorbits/deploy/kubernetes/config.py | 35 ++++++++++++------- python/xorbits/deploy/kubernetes/core.py | 3 +- .../xorbits/deploy/kubernetes/supervisor.py | 1 + python/xorbits/deploy/kubernetes/worker.py | 2 +- 5 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 python/xorbits/deploy/kubernetes/_constants.py diff --git a/python/xorbits/deploy/kubernetes/_constants.py b/python/xorbits/deploy/kubernetes/_constants.py new file mode 100644 index 000000000..17cdf905e --- /dev/null +++ b/python/xorbits/deploy/kubernetes/_constants.py @@ -0,0 +1,15 @@ +# Copyright 2022-2023 XProbe Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SERVICE_PID_FILE = "/tmp/xorbits-service.pid" diff --git a/python/xorbits/deploy/kubernetes/config.py b/python/xorbits/deploy/kubernetes/config.py index c1149cec0..34167d542 100644 --- a/python/xorbits/deploy/kubernetes/config.py +++ b/python/xorbits/deploy/kubernetes/config.py @@ -23,6 +23,7 @@ from ..._mars.utils import calc_size_by_str, parse_readable_size from ...compat._constants import COMPATIBLE_DEPS from ...utils import get_local_package_version, get_local_py_version +from ._constants import SERVICE_PID_FILE try: from kubernetes.client import ApiClient @@ -443,6 +444,21 @@ def build(self): return ret +class CommandExecProbeConfig(ProbeConfig): + """ + Configuration builder for command probe + """ + + def __init__(self, commands: List[str], **kwargs): + super().__init__(**kwargs) + self._commands = commands + + def build(self): + ret = super().build() + ret["exec"] = {"command": self._commands} + return ret + + class ReplicationConfig(KubeConfig): """ Base configuration builder for Kubernetes replication controllers @@ -722,12 +738,17 @@ def config_liveness_probe(self): """ raise NotImplementedError # pragma: no cover - def config_startup_probe(self): + @staticmethod + def config_startup_probe() -> "ProbeConfig": """ The startup probe is used to check whether the startup is smooth. The initial_delay of the startup probe can be sensitive to the system. """ - raise NotImplementedError # pragma: no cover + return CommandExecProbeConfig( + ["sh", "-c", f'until [ -f "{SERVICE_PID_FILE}" ]; do sleep 3s; done'], + failure_thresh=5, + initial_delay=10, + ) @staticmethod def get_local_app_module(mod_name) -> str: @@ -763,11 +784,6 @@ def config_liveness_probe(self) -> "TcpSocketProbeConfig": self._readiness_port, timeout=60, failure_thresh=10, initial_delay=0 ) - def config_startup_probe(self) -> "TcpSocketProbeConfig": - return TcpSocketProbeConfig( - self._readiness_port, timeout=60, failure_thresh=10, initial_delay=20 - ) - def build_container_command(self): cmd = super().build_container_command() start_command = f"/srv/entrypoint.sh {self.get_local_app_module('supervisor')}" @@ -841,11 +857,6 @@ def config_liveness_probe(self) -> "TcpSocketProbeConfig": self._readiness_port, timeout=60, failure_thresh=10, initial_delay=0 ) - def config_startup_probe(self) -> "TcpSocketProbeConfig": - return TcpSocketProbeConfig( - self._readiness_port, timeout=60, failure_thresh=10, initial_delay=20 - ) - def config_init_containers(self) -> List[Dict]: """ The worker pod checks whether the readiness port of the supervisor is successfully opened in the init container. diff --git a/python/xorbits/deploy/kubernetes/core.py b/python/xorbits/deploy/kubernetes/core.py index 9e9779b9b..2e4d5acc6 100644 --- a/python/xorbits/deploy/kubernetes/core.py +++ b/python/xorbits/deploy/kubernetes/core.py @@ -24,6 +24,7 @@ register_cluster_backend, ) from ..._mars.services.cluster.core import NodeRole +from ._constants import SERVICE_PID_FILE from .config import XorbitsReplicationConfig logger = logging.getLogger(__name__) @@ -205,7 +206,7 @@ async def reconstruct_worker(self, address: str): class K8SServiceMixin: @staticmethod def write_pid_file(): - with open("/tmp/xorbits-service.pid", "w") as pid_file: + with open(SERVICE_PID_FILE, "w") as pid_file: pid_file.write(str(os.getpid())) async def wait_all_supervisors_ready(self): diff --git a/python/xorbits/deploy/kubernetes/supervisor.py b/python/xorbits/deploy/kubernetes/supervisor.py index 701068ac2..396017a81 100644 --- a/python/xorbits/deploy/kubernetes/supervisor.py +++ b/python/xorbits/deploy/kubernetes/supervisor.py @@ -20,6 +20,7 @@ class K8SSupervisorCommandRunner(K8SServiceMixin, SupervisorCommandRunner): async def start_services(self): await super().start_services() await self.start_readiness_server() + self.write_pid_file() async def stop_services(self): await self.stop_readiness_server() diff --git a/python/xorbits/deploy/kubernetes/worker.py b/python/xorbits/deploy/kubernetes/worker.py index f6620f169..fc6b4fdd1 100644 --- a/python/xorbits/deploy/kubernetes/worker.py +++ b/python/xorbits/deploy/kubernetes/worker.py @@ -28,7 +28,6 @@ async def start_services(self): from ..._mars.deploy.oscar.worker import start_worker from ..._mars.services.cluster import ClusterAPI - self.write_pid_file() await start_worker( self.pool.external_address, self.args.supervisors, @@ -42,6 +41,7 @@ async def start_services(self): cluster_api = await ClusterAPI.create(self.args.endpoint) await cluster_api.mark_node_ready() await self.start_readiness_server() + self.write_pid_file() async def stop_services(self): await self.stop_readiness_server() From 68300fd9f71f1830fdc0ac645b285a94cbc1520e Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Mon, 6 Feb 2023 07:52:57 +0000 Subject: [PATCH 4/9] avoid set -e --- python/xorbits/deploy/docker/install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/xorbits/deploy/docker/install.sh b/python/xorbits/deploy/docker/install.sh index 126ab6e7a..b420c9839 100644 --- a/python/xorbits/deploy/docker/install.sh +++ b/python/xorbits/deploy/docker/install.sh @@ -25,8 +25,7 @@ elif [ "$source" == "pip_compatible" ]; then mkdir -p /srv/pip_compatible touch /srv/pip_compatible/requirements.txt echo "$content" > /srv/pip_compatible/requirements.txt - pip install -r /srv/pip_compatible/requirements.txt --retries 3 > /srv/pip_compatible/logs.txt 2>&1 - if [ $? -eq 0 ]; then + if pip install -r /srv/pip_compatible/requirements.txt --retries 3 > /srv/pip_compatible/logs.txt 2>&1; then echo "Succeed to install some version-sensitive packages." fi else From d788016858faf02e371e516d7328d8dbb1df9b47 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Mon, 6 Feb 2023 09:16:10 +0000 Subject: [PATCH 5/9] just install cloudpickle --- python/xorbits/compat/_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/xorbits/compat/_constants.py b/python/xorbits/compat/_constants.py index 1d37c4377..c7d965442 100644 --- a/python/xorbits/compat/_constants.py +++ b/python/xorbits/compat/_constants.py @@ -15,4 +15,4 @@ SUPPORTED_PY_VERSIONS = ["3.7", "3.8", "3.9", "3.10"] # Packages that require the compatible version between local and cluster -COMPATIBLE_DEPS = ["cloudpickle", "numpy", "pandas"] +COMPATIBLE_DEPS = ["cloudpickle"] From c45fa0bf5c8864de41a5be0b99fd90294119ff3f Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Tue, 7 Feb 2023 08:39:04 +0000 Subject: [PATCH 6/9] increase timeout --- python/xorbits/deploy/kubernetes/tests/test_kubernetes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py b/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py index 8f6ee287a..baba59796 100644 --- a/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py +++ b/python/xorbits/deploy/kubernetes/tests/test_kubernetes.py @@ -147,7 +147,7 @@ def _start_kube_cluster(**kwargs): api_client, image=image_name, worker_spill_paths=[temp_spill_dir], - timeout=300, + timeout=600, log_when_fail=True, **kwargs, ) @@ -195,7 +195,7 @@ def test_run_in_kubernetes(): worker_mem="1G", worker_cache_mem="64m", use_local_image=True, - pip=["Faker", "cloudpickle==2.2.0"], + pip=["Faker"], ): a = xnp.ones((100, 100), chunk_size=30) * 2 * 1 + 1 b = xnp.ones((100, 100), chunk_size=20) * 2 * 1 + 1 From 5bdcb3d08e9afa4c6957d739f6cd82572c2eefe7 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Tue, 7 Feb 2023 18:03:27 +0800 Subject: [PATCH 7/9] add UT --- python/xorbits/tests/test_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/python/xorbits/tests/test_utils.py b/python/xorbits/tests/test_utils.py index d29c727b1..03dfdde07 100644 --- a/python/xorbits/tests/test_utils.py +++ b/python/xorbits/tests/test_utils.py @@ -15,6 +15,7 @@ import unittest.mock as mock from ..core.execution import need_to_execute +from ..utils import get_local_package_version, get_local_py_version from .mock_pydevd_xml import var_to_xml @@ -29,3 +30,16 @@ def test_safe_repr_str(setup, dummy_df): def test_safe_repr_str_for_mock_pydevd_xml(setup, dummy_df): df = dummy_df + 1 assert "xorbits.core.data.DataRef object" in var_to_xml(df) + + +def test_get_local_py_version(): + ret = get_local_py_version() + assert ret.startswith("3") + + +def test_get_local_package_version(): + pytest_version = get_local_package_version("pytest") + assert pytest_version is not None + + ret = get_local_package_version("yptset") + assert ret is None From 58fdbe5aa49aa1b3c3efa4340d43f314e68a53b2 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Wed, 8 Feb 2023 17:58:19 +0800 Subject: [PATCH 8/9] change doc --- .../user_guide/deployment_kubernetes.po | 116 +++++++++--------- .../user_guide/deployment_kubernetes.rst | 5 +- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po b/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po index a9ad0e56c..2b90551d0 100644 --- a/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po +++ b/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Xorbits \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-02-02 13:00+0800\n" +"POT-Creation-Date: 2023-02-08 17:45+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,9 +29,7 @@ msgstr "前置条件" msgid "" "Install Xorbits on the machine where you plan to run the kubernetes " "deploy code. Refer to :ref:`installation document `." -msgstr "" -"在 Kubernetes 集群管理机器上安装Xorbits。参考 :ref:`安装教程 <" -"installation>`。" +msgstr "在 Kubernetes 集群管理机器上安装Xorbits。参考 :ref:`安装教程 `。" #: ../../source/user_guide/deployment_kubernetes.rst:13 msgid "Kubernetes" @@ -43,16 +41,14 @@ msgid "" "enable the `ingress service `_." msgstr "" -"确保机器上有一个可用的 Kubernetes 集群,同时开启 `ingress 服务 `_。" +"确保机器上有一个可用的 Kubernetes 集群,同时开启 `ingress 服务 `_。" #: ../../source/user_guide/deployment_kubernetes.rst:16 msgid "" "For example, if you use Minikube, start a cluster and enable ingress like" " this:" -msgstr "" -"例如,如果你的机器上安装的是 Minikube ,运行如下命令以启动集群和开启 " -"ingress :" +msgstr "例如,如果你的机器上安装的是 Minikube ,运行如下命令以启动集群和开启 ingress :" #: ../../source/user_guide/deployment_kubernetes.rst:23 msgid "" @@ -61,8 +57,7 @@ msgid "" "enabled correctly." msgstr "" "参考 `Minikube 文档 `_ 以验证 ingress 服务是否正确启动" -"。" +"application-cluster/ingress-minikube/>`_ 以验证 ingress 服务是否正确启动。" #: ../../source/user_guide/deployment_kubernetes.rst:25 msgid "" @@ -70,10 +65,10 @@ msgid "" "`_ is needed due to its" " `limitation `_:" msgstr "" -"对于 macOS 操作系统上基于 docker 后端的 Minikube 集群,由于其网络架构的 `" -"限制 `_,需要安装 `" -"docker-mac-net-connect " -"`_ 以正确使用 ingress 服务代理出来的地址。参考以下命令:" +"对于 macOS 操作系统上基于 docker 后端的 Minikube 集群,由于其网络架构的 `限制 " +"`_,需要安装 `docker-mac-" +"net-connect `_ 以正确使用 " +"ingress 服务代理出来的地址。参考以下命令:" #: ../../source/user_guide/deployment_kubernetes.rst:36 msgid "Then deploy Xorbits cluster, for example:" @@ -89,17 +84,16 @@ msgid "" "http://:80 is ready!`` soon, and you can access the " "web UI of your Xorbits cluster using the endpoint." msgstr "" -"运行上述部署代码后,控制台将出现形如 ``Xorbits endpoint http://:80 is ready!`` 的日志。此时意味着部署成功,你可以通过日志中的" -"地址访问 Xorbits 集群的网页。" +"运行上述部署代码后,控制台将出现形如 ``Xorbits endpoint http://:80 is " +"ready!`` 的日志。此时意味着部署成功,你可以通过日志中的地址访问 Xorbits 集群的网页。" #: ../../source/user_guide/deployment_kubernetes.rst:50 msgid "" "``new_cluster`` api refers to " ":meth:`xorbits.deploy.kubernetes.client.new_cluster`." msgstr "" -"部署代码中的 ``new_cluster`` 接口的完整参数和说明请参考 :meth:`xorbits." -"deploy.kubernetes.client.new_cluster`。" +"部署代码中的 ``new_cluster`` 接口的完整参数和说明请参考 " +":meth:`xorbits.deploy.kubernetes.client.new_cluster`。" #: ../../source/user_guide/deployment_kubernetes.rst:52 msgid "To verify the cluster:" @@ -117,36 +111,48 @@ msgid "" "the kubernetes deployment. Each released version of Xorbits has its " "image, distinguished by the ````." msgstr "" -"Xorbits 默认使用 ``xprobe/xorbits`` 中的镜像。每个 Xorbits 的发布版本均会" -"包含带有版本号标签 ```` 的镜像,形式为 ``xprobe/xorbits:" -"``。" +"Xorbits 默认使用 ``xprobe/xorbits`` 中的镜像。每个 Xorbits 的发布版本均会包含带有版本号标签 " +"```` 的镜像,形式为 ``xprobe/xorbits:``。" -#: ../../source/deployment/kubernetes.rst:68 +#: ../../source/user_guide/deployment_kubernetes.rst:68 +#, fuzzy msgid "" -"Since v0.1.2, each release image of xorbits supports python ``3.7``, " +"Since ``v0.1.2``, each release image of xorbits supports python ``3.7``, " "``3.8``, ``3.9`` and ``3.10``, with ``-py`` as the suffix" " of the image tag." msgstr "" -"自 ``v0.1.2`` 起,每个 Xorbits 的发布版本支持 python ``3.7``、``3.8``、``" -"3.9`` 和 ``3.10`` 四个版本,镜像标签以 ``-py`` 为后缀。" +"自 ``v0.1.2`` 起,每个 Xorbits 的发布版本支持 python ``3.7``、``3.8``、``3.9`` 和 " +"``3.10`` 四个版本,镜像标签以 ``-py`` 为后缀。" -#: ../../source/deployment/kubernetes.rst:71 +#: ../../source/user_guide/deployment_kubernetes.rst:71 msgid "" "For example, ``xprobe/xorbits:v0.1.2-py3.10`` means the image is built on" " python ``3.10``." msgstr "" -"例如,标签为 ``xprobe/xorbits:v0.1.2-py3.10`` 的镜像代表着该镜像中的 " -"Xorbits 基于 python ``3.10`` 版本构建。" +"例如,标签为 ``xprobe/xorbits:v0.1.2-py3.10`` 的镜像代表着该镜像中的 Xorbits 基于 python " +"``3.10`` 版本构建。" -#: ../../source/deployment/kubernetes.rst:73 +#: ../../source/user_guide/deployment_kubernetes.rst:73 msgid "" "By default, the image tagged by ``xprobe/xorbits:`` " "still exists, and it is built on python ``3.9``." msgstr "" -"默认情况下,标签为 ``xprobe/xorbits:`` 的镜像依然存在," -"它基于python ``3.9`` 构建。" +"默认情况下,标签为 ``xprobe/xorbits:`` 的镜像依然存在,它基于python ``3.9`` " +"构建。" + +#: ../../source/user_guide/deployment_kubernetes.rst:75 +#, fuzzy +msgid "" +"Since ``v0.2.0``, Xorbits automatically selects the deployment image " +"according to your local python version by default. For example, if your " +"local python version is ``3.9``, Xorbits uses the image tagged by " +"``xprobe/xorbits:-py3.9`` during deployment." +msgstr "" +"自 ``v0.2.0`` 起, 默认情况下,Xorbits 将根据本地的 Python 版本自动选择 Kubernetes " +"部署时的镜像。例如,如果你的本地 Python 版本为 ``3.9``,Xorbits 将默认在部署过程中使用标签为 " +"``xprobe/xorbits:-py3.9`` 的镜像。" -#: ../../source/deployment/kubernetes.rst:76 +#: ../../source/user_guide/deployment_kubernetes.rst:79 msgid "" "If you need to build an image from source, the related Dockerfiles exists" " at `this position `_ to build " "your own Xorbits image." msgstr "" -"如果你希望从源码制作一个镜像,可以参考我们的 `Dockerfile `_ 和 `" -"Docker 构建文档 `_ 进行制作。" +"如果你希望从源码制作一个镜像,可以参考我们的 `Dockerfile `_ 和 `Docker 构建文档 " +"`_ 进行制作。" -#: ../../source/user_guide/deployment_kubernetes.rst:79 +#: ../../source/user_guide/deployment_kubernetes.rst:82 msgid "" "After you build your own image, push it to a image repository accessible " "by your K8s cluster, e.g. your own DockerHub namespace." -msgstr "" -"一旦你的镜像构建完成,需要将其上传至一个你的 Kubernetes 集群能够访问到的" -"仓库,例如,你自己的 Dockerhub 命名空间。" +msgstr "一旦你的镜像构建完成,需要将其上传至一个你的 Kubernetes 集群能够访问到的仓库,例如,你自己的 Dockerhub 命名空间。" -#: ../../source/user_guide/deployment_kubernetes.rst:81 +#: ../../source/user_guide/deployment_kubernetes.rst:84 msgid "" "Finally, specify your own image during the deployment process through the" " ``image`` option of the " ":meth:`xorbits.deploy.kubernetes.client.new_cluster` api." msgstr "" -"最后,使用部署接口 :meth:`xorbits.deploy.kubernetes.client.new_cluster` " -"中的 ``image`` 选项去指定你的镜像即可。" +"最后,使用部署接口 :meth:`xorbits.deploy.kubernetes.client.new_cluster` 中的 " +"``image`` 选项去指定你的镜像即可。" -#: ../../source/user_guide/deployment_kubernetes.rst:87 +#: ../../source/user_guide/deployment_kubernetes.rst:90 msgid "Install Python Packages" msgstr "安装 Python 包" -#: ../../source/user_guide/deployment_kubernetes.rst:88 +#: ../../source/user_guide/deployment_kubernetes.rst:91 msgid "" "Refer `DockerFile `_ for" @@ -190,20 +193,21 @@ msgid "" "``pip`` and ``conda`` options of the " ":meth:`xorbits.deploy.kubernetes.client.new_cluster` api." msgstr "" -"Xorbits 的发布镜像中已经包含了一些 Python 包,参考 `DockerFile `_ 中安装内容。如果你想安装额外的 Python 包或者改变其中" -"某些包的版本,使用 :meth:`xorbits.deploy.kubernetes.client.new_cluster` " -"接口中的 ``pip`` 和 ``conda`` 选项即可。" +"Xorbits 的发布镜像中已经包含了一些 Python 包,参考 `DockerFile `_ " +"中安装内容。如果你想安装额外的 Python 包或者改变其中某些包的版本,使用 " +":meth:`xorbits.deploy.kubernetes.client.new_cluster` 接口中的 ``pip`` 和 " +"``conda`` 选项即可。" -#: ../../source/user_guide/deployment_kubernetes.rst:91 +#: ../../source/user_guide/deployment_kubernetes.rst:94 msgid "" "Please make sure your K8s cluster can access the corresponding `channel " "of conda `_ or `PyPi `_, when " "using ``pip`` and ``conda`` options." msgstr "" -"注意,使用 ``pip`` 和 ``conda`` 选项时,请确保你的 Kubernetes 集群能够" -"访问 `PyPi `_ 和 `conda对应的通道 `_。" +"注意,使用 ``pip`` 和 ``conda`` 选项时,请确保你的 Kubernetes 集群能够访问 `PyPi " +"`_ 和 `conda对应的通道 " +"`_。" diff --git a/doc/source/user_guide/deployment_kubernetes.rst b/doc/source/user_guide/deployment_kubernetes.rst index 1b951ed84..95efe08d7 100644 --- a/doc/source/user_guide/deployment_kubernetes.rst +++ b/doc/source/user_guide/deployment_kubernetes.rst @@ -65,13 +65,16 @@ By default, the image tagged by ``xprobe/xorbits:`` on `our Doc is used in the kubernetes deployment. Each released version of Xorbits has its image, distinguished by the ````. .. note:: - Since v0.1.2, each release image of xorbits supports python ``3.7``, ``3.8``, ``3.9`` and ``3.10``, + Since ``v0.1.2``, each release image of xorbits supports python ``3.7``, ``3.8``, ``3.9`` and ``3.10``, with ``-py`` as the suffix of the image tag. For example, ``xprobe/xorbits:v0.1.2-py3.10`` means the image is built on python ``3.10``. By default, the image tagged by ``xprobe/xorbits:`` still exists, and it is built on python ``3.9``. + Since ``v0.2.0``, Xorbits automatically selects the deployment image according to your local python version by default. + For example, if your local python version is ``3.9``, Xorbits uses the image tagged by ``xprobe/xorbits:-py3.9`` during deployment. + If you need to build an image from source, the related Dockerfiles exists at `this position `_ for reference. You can follow the `Docker document `_ to build your own Xorbits image. From 3aabaa0c6026eb4f895aac915f9c200f2b890ea6 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Wed, 8 Feb 2023 18:00:59 +0800 Subject: [PATCH 9/9] remove fuzzy --- .../zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po b/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po index 2b90551d0..88f3be794 100644 --- a/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po +++ b/doc/source/locale/zh_CN/LC_MESSAGES/user_guide/deployment_kubernetes.po @@ -115,7 +115,6 @@ msgstr "" "```` 的镜像,形式为 ``xprobe/xorbits:``。" #: ../../source/user_guide/deployment_kubernetes.rst:68 -#, fuzzy msgid "" "Since ``v0.1.2``, each release image of xorbits supports python ``3.7``, " "``3.8``, ``3.9`` and ``3.10``, with ``-py`` as the suffix" @@ -141,7 +140,6 @@ msgstr "" "构建。" #: ../../source/user_guide/deployment_kubernetes.rst:75 -#, fuzzy msgid "" "Since ``v0.2.0``, Xorbits automatically selects the deployment image " "according to your local python version by default. For example, if your "