jina-ai / serve

☁️ Build multimodal AI applications with cloud-native stack
https://jina.ai/serve
Apache License 2.0
21.13k stars 2.22k forks source link

perf version of v3.3.2 throw error `No module named 'prometheus_client'` #4647

Closed mapleeit closed 2 years ago

mapleeit commented 2 years ago

Describe the bug

docker run --rm --entrypoint jina jinaai/jina:3-py37-perf -v

Result ```bash ❯ docker run --rm --entrypoint jina jinaai/jina:3-py37-perf -v Unable to find image 'jinaai/jina:3-py37-perf' locally 3-py37-perf: Pulling from jinaai/jina 6d4a449ac69c: Already exists ac1330f40b39: Already exists 4d9a1c11a1ed: Already exists fa701256a623: Already exists cc3042fcb5c9: Already exists 996c43f651d4: Already exists 9fde4d3a93d0: Already exists 02d6bd1d947b: Already exists 5e5b8f91eeac: Already exists Digest: sha256:463b0b75c7a38f84f4a206c016ae6f2236b6791ff951e7181caff53c82923afc Status: Downloaded newer image for jinaai/jina:3-py37-perf ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ │ │ /usr/local/bin/jina:8 in │ │ │ │ 5 from cli import main │ │ 6 if __name__ == '__main__': │ │ 7 │ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) │ │ ❱ 8 │ sys.exit(main()) │ │ 9 │ │ /usr/local/lib/python3.7/site-packages/cli/__init__.py:202 in main │ │ │ │ 199 │ │ │ │ 200 │ │ from cli import api │ │ 201 │ │ │ │ ❱ 202 │ │ args = _get_run_args() │ │ 203 │ │ │ │ 204 │ │ getattr(api, args.cli.replace('-', '_'))(args) │ │ 205 │ │ │ │ /usr/local/lib/python3.7/site-packages/cli/__init__.py:10 in _get_run_args │ │ │ │ 7 │ │ 8 │ │ 9 def _get_run_args(print_args: bool = True): │ │ ❱ 10 │ from jina.helper import get_rich_console │ │ 11 │ from jina.parsers import get_main_parser │ │ 12 │ │ │ 13 │ console = get_rich_console() │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/__init__.py:196 in │ │ │ │ 193 │ │ 194 # Client │ │ 195 from jina.clients import Client │ │ ❱ 196 from jina.orchestrate.flow.asyncio import AsyncFlow │ │ 197 │ │ 198 # Flow │ │ 199 from jina.orchestrate.flow.base import Flow │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/orchestrate/flow/asyncio.py:1 in │ │ │ │ │ │ ❱ 1 from jina.orchestrate.flow.base import Flow │ │ 2 from jina.clients.mixin import AsyncPostMixin │ │ 3 │ │ 4 │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/orchestrate/flow/base.py:60 in │ │ │ │ │ │ 57 ) │ │ 58 from jina.jaml import JAMLCompatible │ │ 59 from jina.logging.logger import JinaLogger │ │ ❱ 60 from jina.orchestrate.deployments import Deployment │ │ 61 from jina.orchestrate.flow.builder import _hanging_deployments, allow │ │ 62 from jina.parsers import ( │ │ 63 │ set_client_cli_parser, │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/orchestrate/deployments/__init__ │ │ .py:13 in │ │ │ │ 10 from jina.helper import CatchAllCleanupContextManager │ │ 11 from jina.hubble.hubio import HubIO │ │ 12 from jina.jaml.helper import complete_path │ │ ❱ 13 from jina.orchestrate.pods.container import ContainerPod │ │ 14 from jina.orchestrate.pods.factory import PodFactory │ │ 15 from jina.serve.networking import GrpcConnectionPool, host_is_local, i │ │ 16 │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/orchestrate/pods/__init__.py:15 │ │ in │ │ │ │ 12 from jina.helper import typename │ │ 13 from jina.jaml import JAML │ │ 14 from jina.logging.logger import JinaLogger │ │ ❱ 15 from jina.orchestrate.pods.helper import ConditionalEvent, _get_event, │ │ 16 from jina.serve.runtimes.asyncio import AsyncNewLoopRuntime │ │ 17 │ │ 18 __all__ = ['BasePod', 'Pod'] │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/orchestrate/pods/helper.py:12 in │ │ │ │ │ │ 9 from jina.enums import GatewayProtocolType, PodRoleType, RuntimeBacken │ │ 10 from jina.hubble.helper import is_valid_huburi │ │ 11 from jina.hubble.hubio import HubIO │ │ ❱ 12 from jina.serve.networking import GrpcConnectionPool │ │ 13 from jina.types.request.control import ControlRequest │ │ 14 │ │ 15 if TYPE_CHECKING: │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/serve/networking.py:16 in │ │ │ │ │ │ 13 │ │ 14 from jina.enums import PollingType │ │ 15 from jina.logging.logger import JinaLogger │ │ ❱ 16 from jina.proto import jina_pb2_grpc │ │ 17 from jina.types.request import Request │ │ 18 from jina.types.request.control import ControlRequest │ │ 19 from jina.types.request.data import DataRequest │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/proto/jina_pb2_grpc.py:5 in │ │ │ │ │ │ 2 """Client and server classes corresponding to protobuf-defined service │ │ 3 import grpc │ │ 4 │ │ ❱ 5 from . import serializer as jina__pb2 │ │ 6 │ │ 7 │ │ 8 class JinaControlRequestRPCStub(object): │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/proto/serializer.py:5 in │ │ │ │ │ │ 2 from typing import Iterable, List, Union │ │ 3 │ │ 4 from jina.proto import jina_pb2 │ │ ❱ 5 from jina.types.request.control import ControlRequest │ │ 6 from jina.types.request.data import DataRequest │ │ 7 │ │ 8 │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/types/request/__init__.py:4 in │ │ │ │ │ │ 1 import traceback │ │ 2 from typing import Optional │ │ 3 │ │ ❱ 4 from jina.serve.executors import BaseExecutor │ │ 5 from jina.proto import jina_pb2 │ │ 6 from jina.types.mixin import ProtoTypeMixin │ │ 7 │ │ │ │ /usr/local/lib/python3.7/site-packages/jina/serve/executors/__init__.py:9 in │ │ │ │ │ │ 6 from types import SimpleNamespace │ │ 7 from typing import TYPE_CHECKING, Any, Dict, List, Optional, Type, Uni │ │ 8 │ │ ❱ 9 from prometheus_client import Summary │ │ 10 │ │ 11 from jina import __args_executor_init__, __default_endpoint__ │ │ 12 from jina.enums import BetterEnum │ ╰──────────────────────────────────────────────────────────────────────────────╯ ModuleNotFoundError: No module named 'prometheus_client' ```

Describe how you solve it Move prometheus_client from standard to core level


In addition:

We need to add a sanity check to make sure the perf version can always work. Because Hub heavily depends on it. It's the 2rd or 3rd time we meet the same error.

mapleeit commented 2 years ago

Ah. I noticed that #4641 is trying to fix this.