stale-artist-94777
12/19/2024, 12:11 PM[ah9fgw2d68t8zpflfkvb-n0-0] terminated with exit code (2). Reason [Error]. Message:
Usage: pyflyte-fast-execute [OPTIONS] [TASK_EXECUTE_CMD]...
Try 'pyflyte-fast-execute --help' for help.
Error: No such option: --inputs
.
Reading through the entrypoint code here, it looks like --inputs
is intended for the subsequent call to pyflyte-execute
, but the first pyflyte-fast-execute
call is raising an error before it gets that far due to the unknown option. According to the click docs, ignore_unknown_options=True
should be set to allow passing through unknown options, but I don't see that being set anywhere.
On the other hand, when I run using the default Flyte Docker container, the same command runs totally fine.
Do I need to make sure to install a particular version of click
in my container, or do some other setup, in order to make it work?stale-artist-94777
12/19/2024, 12:25 PM--
escape sequence, rather than using ignore_unknown_options
. I see that in the task definition, so I wonder why that is being ignored?
[
"pyflyte-fast-execute",
"--additional-distribution",
"<s3://flyte-metadata>...",
"--dest-dir",
"/root",
"--",
"pyflyte-execute",
"--inputs",
"{{.input}}",
...
]
stale-artist-94777
12/19/2024, 1:03 PMENTRYPOINT
for my container was ["poetry", "run"]
, however it appears that Poetry will consume the first --
passed to it, which merged the list of arguments for pyflyte-execute
into the list for pyflyte-fast-execute
, producing the error above.
The fix is to pass an extra separator before the actual arguments to poetry run
, so:
ENTRYPOINT ["poetry", "run", "--"]
acoustic-oyster-33294
12/19/2024, 1:50 PMflytekit
with poetry instead of uv
or pip
?stale-artist-94777
12/19/2024, 1:52 PMuv
nowadays, it looks greatacoustic-oyster-33294
12/19/2024, 1:56 PMimport pandas as pd
from flytekit import task, workflow
image_spec = "{{.image.example_image.fqn}}:{{.image.example_image.version}}"
@task(container_image=image_spec)
def count_rows(data: pd.DataFrame) -> int:
"""Count rows in DataFrame."""
return data.shape[0]
@workflow
def pipeline(data: pd.DataFrame) -> int:
"""Pipeline."""
rows_ct = count_rows(data)
return rows_ct
With a Dockerfile
# Use an official miniconda3 as a parent image
FROM continuumio/miniconda3
WORKDIR /root
# Copy requirements into the container
COPY requirements.txt /root/requirements.txt
# Install requirements
RUN pip install uv==0.4.18
RUN uv pip install -r /root/requirements.txt --system --no-cache-dir
With requirements
flytekit==1.14.1
pandas==2.2.1
pyarrow==18.1.0
fastparquet==2024.11.0
numpy==1.26.4
And configuration
admin:
...
images:
example_image: localhost:30000/example-image:latest
Running with:
pyflyte --config ~/.flyte/config.yaml run --remote --copy all -p <PROJECT> -d <DOMAIN> workflows/<SCRIPT>.py pipeline --data s3://<INPUT>
careful-australia-19356
12/19/2024, 10:11 PMfreezing-airport-6809
thankful-minister-83577
thankful-minister-83577
stale-artist-94777
12/20/2024, 5:11 PMFROM pytorch/pytorch:2.1.2-cuda11.8-cudnn8-devel
# Install system dependencies
RUN apt-get update --fix-missing && \
apt-get install -y git python3-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies before copying the rest of the code
WORKDIR /app
COPY poetry.lock pyproject.toml /app/
RUN pip --disable-pip-version-check install "poetry==1.5.1" awscli && \
poetry config virtualenvs.create true && \
poetry config virtualenvs.in-project true && \
poetry config virtualenvs.options.always-copy true && \
poetry install --no-interaction --no-ansi
# Copy the rest of the code
COPY . /app
# Set up a generic entrypoint so we can run arbitrary commands in the poetry environment
# Pass an argument separator so that poetry doesn't consume any further argument separators
ENTRYPOINT ["poetry", "run", "--"]
I've also ran into #4853, as the code in the container was being used instead of the local code when I tried a remote map_tasks
, and an issue where passing Pydantic objects from an @dynamic
workflow to a @task
fails on remote with an error like:
(type [simple:BINARY]) doesn't match expected type [simple:STRUCT ...]
(works locally, I've not found a ticket for that yet)
So a few things work out before I get into really migrating my workflow over!thankful-minister-83577