我已经编写了几个python脚本,可以对交易策略进行回溯测试。我正试图通过docker compose部署这些
feeder容器将测试文件复制到一个工作目录中,backtester容器将在该目录中拾取并处理它们。然后将处理后的测试文件发送到“已完成的工作”文件夹。backtester输出的一些CSV文件随后会写入另一台计算机上的NFS共享。我应该提到的是,这些都是在Ubuntu 20.04上运行的
据我所知,一切正常,但由于某种原因,“docker compose up”命令挂起“Attaching to”。应该有打印语句的进一步输出(我已经取消了DockerFile的缓冲,所以这些应该会显示出来)。我还让它运行了一段时间,看看是否有任何东西正在被处理,看起来容器从未启动过。我查看了所有其他处理此问题的线程,但没有找到解决此问题的解决方案
任何洞察都是非常感谢的。谢谢
以下是docker compose文件:
version: '3.4'
services:
feeder:
image: feeder
build:
context: .
dockerfile: ./Dockerfile.feeder
volumes:
- /home/danny/io:/var/lib/io
worker1:
image: backtester
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /home/danny/io/input/workers/worker1:/var/lib/io/input
- /home/danny/io/input/completedwork:/var/lib/io/archive
- /nfs/tests:/var/lib/tests
worker2:
image: backtester
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /home/danny/io/input/workers/worker2:/var/lib/io/input
- /home/danny/io/input/completedwork:/var/lib/io/archive
- /nfs/tests:/var/lib/tests
worker3:
image: backtester
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /home/danny/io/input/workers/worker3:/var/lib/io/input
- /home/danny/io/input/completedwork:/var/lib/io/archive
- /nfs/tests:/var/lib/tests
以下是backtester的Dockerfile:
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim-buster
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
# RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
# USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "backtester5.py"]
以下是进料器的Dockerfile:
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim-buster
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
# RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
# USER appuser
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python", "feeder.py"]
下面是显示的最后一条消息:
Attaching to project4_feeder_1, project4_worker1_1, project4_worker2_1, project4_worker3_1
已经三周没有回复了,但我只是想用我的发现更新一下。在我让“docker compose up”运行的所有情况下,它最终都会启动
有时需要30分钟,但每次都要开始
相关问题 更多 >
编程相关推荐