bright-author-73055
08/24/2023, 2:14 PMbright-author-73055
08/24/2023, 2:14 PMbright-author-73055
08/24/2023, 2:21 PMENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
but a little out of my element herebright-author-73055
08/24/2023, 3:07 PMdocker build -t parsely-transformers-pytorch-gpu .
And then run it in interactive mode and import stuff
wooyoung.moon docker % docker run -it parsely-transformers-pytorch-gpu
root@737ee207aeac:/app# python
Python 3.9.5 (default, Nov 23 2021, 15:27:38)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from metaflow import FlowSpec
>>>
But when I try to run things in batch I see this error now:
2023-08-24 14:52:51.459 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Task is starting (status STARTING)...
2023-08-24 14:53:18.350 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Task is starting (status RUNNING)...
2023-08-24 14:53:17.530 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Setting up task environment.
2023-08-24 14:53:31.701 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Downloading code package...
2023-08-24 14:53:32.390 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Code package downloaded.
2023-08-24 14:53:32.422 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Task is starting.
2023-08-24 14:53:33.185 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] Traceback (most recent call last):
2023-08-24 14:53:35.691 [36/train_model/146 (pid 66166)] AWS Batch error:
2023-08-24 14:53:37.188 [36/train_model/146 (pid 66166)] Essential container in task exited This could be a transient error. Use @retry to retry.
2023-08-24 14:53:37.188 [36/train_model/146 (pid 66166)]
2023-08-24 14:53:33.185 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] File "/app/metaflow/train_section_model_flow_v2.py", line 15, in <module>
2023-08-24 14:53:33.185 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] from metaflow import FlowSpec, step, batch
2023-08-24 14:53:33.185 [36/train_model/146 (pid 66166)] [e1067133-989c-437f-9ed8-05f29bafde26] ImportError: cannot import name 'FlowSpec' from 'metaflow' (/app/metaflow/__init__.py)
2023-08-24 14:53:37.423 [36/train_model/146 (pid 66166)] Task failed.
2023-08-24 14:53:37.634 Workflow failed.
2023-08-24 14:53:37.634 Terminating 0 active tasks...
2023-08-24 14:53:37.634 Flushing logs...
Step failure:
Step train_model (task-id 146) failed.bright-author-73055
08/24/2023, 3:09 PMFROM nvidia/cuda:12.2.0-base-ubuntu20.04
ENV DEBIAN_FRONTEND noninteractive
# Install basic dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
python3.9 \
python3.9-dev \
python3.9-distutils \
python3.9-venv \
curl \
ca-certificates && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
update-alternatives --set python3 /usr/bin/python3.9 && \
rm -rf /var/lib/apt/lists/*
# Install pip for Python 3.9
RUN curl <https://bootstrap.pypa.io/get-pip.py> -o get-pip.py && \
python3.9 get-pip.py && \
rm get-pip.py
# Set up a working directory
WORKDIR /app
RUN ln -s /usr/bin/python3 /usr/bin/python & \
ln -s /usr/bin/pip3 /usr/bin/pip
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY pyproject.toml poetry.lock ./
RUN pip install poetry
RUN poetry install --without=devbright-author-73055
08/24/2023, 4:58 PMbright-author-73055
08/24/2023, 5:18 PMadventurous-plastic-90730
08/28/2023, 4:31 PMbright-author-73055
08/28/2023, 4:40 PMadventurous-plastic-90730
08/28/2023, 5:17 PMadventurous-plastic-90730
10/05/2023, 9:50 PMbright-author-73055
10/06/2023, 12:38 PMhigh-engineer-80628
10/06/2023, 5:17 PM@conda seem like a hard requirement for this feature, and at least in theory it's an extremely smooth way to handle an otherwise painful process. Unfortunately we have had a lot of issues with both speed and package availability, even after taking the time to build out a micromamba based dev container with the (excellent) metaflow-netflixext.
My main question is whether poetry is compatible with deploying flow-specific envs to cloud resources, with the same ease found in the @conda decorator.bright-author-73055
10/10/2023, 5:59 PMpyproject.toml to run on Batch.
Actually took a decent amount of time because of a bunch of little issues that might be relatively specific to our container requirements (e.g. cuda and libreoffice) but it seems to be working reasonably well now.
We also aren't doing anything slick with different steps requiring different sets of packages or anything.
Not sure how different or specific your different flows are in terms of its requirements, but if it's as simple just differing pyproject.toml and poetr.lock files then I bet it's not a huge deal to use poetry for this.
Does that kinda help? Please let me know if I totally missed the mark!handsome-city-1083
06/21/2024, 8:11 AM