<@ULVA73B9P> Seeing an odd error while running a p...
# ask-marvin
e
@Marvin Seeing an odd error while running a prefect flow on Cloud Run Jobs (via serverless push + pre-built docker image on prefect 3.1.4), any ideas?
Copy code
prefect.exceptions.SignatureMismatchError: Function expects parameters ['args', 'kwargs']
I’ve deployed via prefect.yaml with no params specified, and i pass in a param via cmdline when running the flow (I’ve also tried running via the UI, same results). I’ve taken a look at the logs on the Cloud Run Job container too and didn’t see anything else clearly useful. i did see https://github.com/PrefectHQ/prefect/issues/14663 but it says it is resolved.
m
The error you're encountering,
SignatureMismatchError: Function expects parameters ['args', 'kwargs']
, appears to be related to a parameter validation issue. This type of error usually arises when there is a mismatch between the expected and provided function parameters during flow executions, especially when using Prefect's deployment features. This issue was also noted in a GitHub issue (#14663), suggesting the mismatch might occur when parameters are expected differently than they're being supplied. This can happen particularly when running flows through interfaces that expect specific parameter structures, like directly in the UI or via CLI commands. From the Prefect 3.x documentation, it's important that: - Flow parameters must be specified as keyword arguments. Positional arguments may not be accepted (source: Prefect V3 docs). - Parameters are validated before a flow starts. If invalidated due to incorrect specification, it results in immediate failure of the flow without entering the "Running" state. In your context: 1. Double-check your flow's parameter structure, ensuring that parameters are supplied as keyword arguments both in the YAML deployment and any trigger interfaces (CLI/UI). 2. Ensure your Docker environment and deployment configurations align with Prefect's guidelines for flow deployments, particularly when building and deploying Docker images (source: Prefect V3 Docker deployment). Try modifying the way you pass parameters, maybe verifying through test runs locally before deploying on Cloud Run Jobs. If the mysterious issue persists, it may call for another review of your configurations, or even reaching out to the Prefect community for additional support! Sometimes these things feel like the universe is against us, but remember, even the universe has bugs.
n
do you have all your deps installed when deploying? the gist of that issue is that when you dont, we put a placeholder signature in for your flow (bc we cant know what types are in the signature if we cant import the types)
i.e. what does your
@flow
decorated function's signature look like?
e
do you have all your deps installed when deploying
--> the docker container has installed external dependencies via requirements.txt, as does my virtual environment from which i'm running
prefect deploy ...
. but now I'm wondering if the actual issue is that there's an issue discovering local modules from the codebase itself. the function signature is below, where
State
is defined in a different module in my codebase.
Copy code
@flow(
    name="Catalist Ingest Flow",
    description="Ingest raw files from Catalist.",
    version=os.getenv("GIT_COMMIT_SHA"),
)
def load_catalist_state(state: State, do_post_processing: bool = False) -> None:
some relevant info--the package is defined inside
repo_name/python/src/<pkg>
and there have sometimes been extra setup to get installs to work due to the
src
. My PrefectDockerfile looks like the following
Copy code
FROM python:3.10-slim
WORKDIR /app
ENV PROJECT_ROOT="/app"
COPY . .
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y nodejs npm 
RUN npm install -g @universe/address-parser
RUN apt-get install -y python3.10 python3-pip build-essential git
# RUN apt-get install -y gdal-bin libgdal-dev g++
RUN pip install --upgrade pip

RUN pip install -r python/requirements.txt
CMD cd python/src
ah, i fixed it! i needed to add
RUN pip install -e python
to my PrefectDockerfile to install my package