hi folks! For context we’ve been using Metaflow fo...
# ask-metaflow
e
hi folks! For context we’ve been using Metaflow for a couple of years on and off at my work. But i’m trying to run the flow in a different way to usual. The flow runs fine locally but fails on AWS Batch (with custom docker container) with an obtuse
NameError
message (using metaflow 2.8.1 – not sure what other information to provide).
Copy code
File "/app/metaflow/metaflow/_vendor/click/types.py", line 89, in __init__
2023-04-03 07:39:50.134 [1345/start/34057 (pid 1095)] [ddbe8294-cd98-411e-8c5c-1f1ab59aaf87]     self.name = func.__name__
2023-04-03 07:39:50.134 [1345/start/34057 (pid 1095)] [ddbe8294-cd98-411e-8c5c-1f1ab59aaf87]   File "/usr/local/lib/python3.9/typing.py", line 711, in __getattr__
2023-04-03 07:39:50.134 [1345/start/34057 (pid 1095)] [ddbe8294-cd98-411e-8c5c-1f1ab59aaf87]     raise AttributeError(attr)
2023-04-03 07:39:50.135 [1345/start/34057 (pid 1095)] [ddbe8294-cd98-411e-8c5c-1f1ab59aaf87] AttributeError: __name__
the Dockerfile for the image I’m running the flow steps ends with
Copy code
CMD python /app/entrypoints/run-my-flow.py run \
    --with batch
I presume that’s fine, and that Metaflow will override this
CMD
as needed for the steps (as it’s a similar pattern to what we’ve used in the past)
(the reason we have that
CMD
is that we’ve historically used the same docker container to run the orchestrator as the steps and passed in args via env var – but right now the orchestrator is being run directly and the docker container is only for the steps)
a
@echoing-kangaroo-34845 to rule out any AWS Batch related issues - does the step fail even when it isn't executed on AWS Batch?
e
no it’s fine when run locally
Copy code
2023-04-03 23:01:18.094 [1348/start/34064 (pid 1528)] Task finished successfully.
a
Do you see the same error when you use Python 3.7 rather than 3.9?
e
interesting, I haven’t tried that. not sure our code is 3.7 compatible (but would work with 3.8 probably – would that be helpful?). Is there some reason we’d see errors relating to python version in docker but not running locally?
OK @square-wire-39606 I couldn’t get our code to work under python 3.7 but both our code and Metaflow seems to work under 3.8. Are there known issues under python 3.9? does this need to be in a bug tracker do you think?
a
It could be the case. We will create an issue and debug this. Cc @bulky-afternoon-92433
👍 1
b
@echoing-kangaroo-34845 trying to reproduce this issue now and thought of some follow-up questions regarding your setup: • is the custom docker container on batch being successfully used for other flows, or is it purpose-built for this one that is failing? • if public, what is the base image for the container? • python version, metaflow version, arch of the machine invoking the
run --with batch
• what kind of environment was the custom docker container built on?
I'm trying to rule out possible conflicts between what was baked into the docker image vs. what is being bundled into the codepackage that metaflow sends to S3.
e
@bulky-afternoon-92433 it’s a custom image (not public). here’s an (edited) version of the dockerfile with what I think are the relevant lines (old failing version – works under 3.8)
Copy code
FROM --platform=linux/amd64 python:3.9-slim

RUN apt-get update && apt-get install -y git curl

ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install 'poetry<1.5'

WORKDIR /app
COPY . /app/
RUN poetry install --without=dev
python version where flow is being kicked off:
3.9.12
. arch is
x86_64
. metaflow version is same as in step containers:
2.8.1
(flow is being run from a different docker container running on sagemaker studio, built from
FROM continuumio/miniconda3:4.12.0
image)
@bulky-afternoon-92433 any progress on this? is there an issue in the tracker? we have, for boring reasons, a hard dependency on python 3.9 (or ideally 3.10 now) for external reasons
b
Heya, unfortunately this has been on a bit of a back-burner for me due to not being able to reproduce the issue, and as I understood from our prior discussions that the issue was resolved for you for the time being with a version change? The hard dependency for a more recent python version makes sense though, as versions get sunset, so I'll put some more work into this definitely. Getting back to trying to reproduce the issue, some further questions on your setup: • have you ruled out possible conflicts in the installed poetry dependencies from the built Docker image? I notice that the venv is added to the path, so there might be some unintended rewiring that happens here • you mentioned the flow ran fine locally (presumably
--with batch
, and using the same custom image). Have you tried deploying it as a step-function? Wondering if the issue is limited to sagemaker or not