【问题标题】:gunicorn.errors.HaltServer while deploying to google cloud run for a python applicationgunicorn.errors.HaltServer 同时部署到谷歌云运行 python 应用程序
【发布时间】:2020-10-18 08:36:06
【问题描述】:

这是我的 dockerfile。我正在尝试使用以下两个命令将此图像部署到谷歌云运行

1. gcloud builds submit --tag gcr.io/smartshop-292203/data_science --timeout=20h0m0s
2. gcloud run deploy --image gcr.io/smartshop-292203/data_science --platform managed

我正在使用这个参考链接

https://cloud.google.com/run/docs/quickstarts/build-and-deploy#python

Dockerfile:

FROM python:3.8

# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./

# update image and install cmake
RUN apt-get update 
RUN apt-get upgrade -y
RUN apt-get install cmake -y
RUN apt-get install libgl1-mesa-glx -y

# Install production dependencies.
RUN pip install -r requirements.txt

# command to run on container start
# CMD [ "python", "./app.py" ] 
# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
CMD exec gunicorn --bind :8001 --workers 1 --threads 8 --timeout 1500 main:app
# CMD exec gunicorn main:app --bind 0.0.0.0:8080 --worker-class aiohttp.GunicornWebWorker
# CMD exec gunicorn --bind 0.0.0.0:8080 wsgi:main
# CMD ["/bin/bash"]

我遇到的错误:

        "Traceback (most recent call last):
    File "/usr/local/bin/gunicorn", line 8, in <module>
        sys.exit(run())
    File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
        WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, in run
        super().run()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run
        Arbiter(self).run()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 227, in run
        self.halt()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt
        self.stop()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop
        time.sleep(0.1)
    File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
        self.reap_workers()
    File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
        raise HaltServer(reason, self.WORKER_BOOT_ERROR)
    gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>"

会有什么问题? 请看一下

【问题讨论】:

    标签: python docker gunicorn


    【解决方案1】:

    尝试使用--preload 运行gunicorn。您将看到完整的堆栈跟踪。应用创建步骤似乎有问题。

    您还可以使用以下方式部署您的应用: gcloud beta run deploy - deploy

    更多信息https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-17
      • 2015-12-24
      • 2017-05-24
      • 1970-01-01
      • 2020-09-06
      • 2021-10-09
      • 1970-01-01
      • 2015-12-22
      相关资源
      最近更新 更多