Sarhan
08/01/2024, 4:04 PMopt/prefect/
. Image is meant to be used for all my deployments so no ENTRYPOINT or CMD is set.
Deployment is done with a prefect.yaml file with just the build (that references the Dockerfile), push and deployments section. CI/CD runs fine and my flow gets deployed. This error appears when I try running the deployed flow.
I’ve reached the try-anything-and-see-what-works phase. Any clue what I should do? 🙏
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 426, in retrieve_flow_then_begin_flow_run
else await load_flow_from_flow_run(
File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 100, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 290, in load_flow_from_flow_run
basepath = deployment.path or Path(deployment.manifest_path).parent
File "/usr/local/lib/python3.10/pathlib.py", line 960, in __new__
self = cls._from_parts(args)
File "/usr/local/lib/python3.10/pathlib.py", line 594, in _from_parts
drv, root, parts = self._parse_args(args)
File "/usr/local/lib/python3.10/pathlib.py", line 578, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Sarhan
08/01/2024, 4:07 PMopt/prefect/
in the prefect.yaml’s pull section and I get a FileNotFoundError
when running the deploymentNate
08/01/2024, 4:48 PMNate
08/01/2024, 4:48 PMbasepath
is ending up as None
somehow, but its not yet clear to me how thats happeningSarhan
08/02/2024, 12:50 AMNate
08/02/2024, 12:53 PMSarhan
08/02/2024, 2:04 PMdeployments:
- name: test-flow-deployment
entrypoint: scripts/flows/test_flow.py:test_flow
tags: [test]
work_pool:
name: default-ecs-work-pool
work_queue_name: default-push-queue
job_variables:
image: "{{ build-image.image }}"
Nate
08/02/2024, 2:18 PMprefect version
output and your flow definition? feel free to DM if you dont want to share hereSarhan
08/02/2024, 2:19 PMAnthony W
08/26/2024, 9:27 PMNate
08/26/2024, 9:35 PMAnthony W
08/26/2024, 10:28 PM- name: test_flow
version:
tags: []
description:
entrypoint: /flows/test_flows/test_flow.py:test_flow
parameters: {}
work_pool:
name: ecs-dev
work_queue_name: default
job_variables: {}
schedules: []
Also, since this looks to be an issue with Prefect not finding the flow code, here is my dockerfile:
FROM python:3.12.3-slim
WORKDIR /app
# Package prep
...
# Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN export PYTHONPATH=/app
Nate
08/26/2024, 10:39 PMpull
step at runtime
• a COPY
into your image at deployment timeAnthony W
08/26/2024, 11:00 PMpull:
- prefect.deployments.steps.git_clone:
repository: <https://gitlab.repolinkhere.git>
branch: dev
access_token: '{{ prefect.blocks.secret.-repo-token
}}'
Nate
08/26/2024, 11:17 PM'{{ prefect.blocks.secret.-repo-token
}}'
Anthony W
08/26/2024, 11:19 PMNate
08/26/2024, 11:21 PMAnthony W
08/26/2024, 11:22 PMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/prefect/engine.py", line 255, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/contextlib.py", line 222, in __aexit__
await self.gen.athrow(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 218, in asyncnullcontext
yield
File "/usr/local/lib/python3.11/site-packages/prefect/client/utilities.py", line 47, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/deployments.py", line 155, in load_flow_from_flow_run
basepath = deployment.path or Path(deployment.manifest_path).parent
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/pathlib.py", line 871, in __new__
self = cls._from_parts(args)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/pathlib.py", line 509, in _from_parts
drv, root, parts = self._parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/pathlib.py", line 493, in _parse_args
a = os.fspath(a)
^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType
Anthony W
08/26/2024, 11:24 PMNate
08/26/2024, 11:27 PMNate
08/26/2024, 11:27 PMDave D
10/09/2024, 8:25 PMFlow could not be retrieved from deployment.
Its random when it happens but we are also using Kubernetes (EKS w/ Fargate Nodes), and the code exists on the custom Docker Container image we are using so no code needs to be pulled in.
> Flow could not be retrieved from deployment.
> Traceback (most recent call last):
> File "/usr/local/lib/python3.9/site-packages/prefect/engine.py", line 246, in retrieve_flow_then_begin_flow_run
> flow = await load_flow_from_flow_run(flow_run, client=client)
> File "/usr/local/lib/python3.9/site-packages/prefect/client.py", line 105, in with_injected_client
> return await fn(*args, **kwargs)
> File "/usr/local/lib/python3.9/site-packages/prefect/deployments.py", line 50, in load_flow_from_flow_run
> basepath = deployment.path or Path(deployment.manifest_path).parent
> File "/usr/local/lib/python3.9/pathlib.py", line 1082, in new
> self = cls._from_parts(args, init=False)
> File "/usr/local/lib/python3.9/pathlib.py", line 707, in _from_parts
> drv, root, parts = self._parse_args(args)
> File "/usr/local/lib/python3.9/pathlib.py", line 691, in _parse_args
> a = os.fspath(a)
> TypeError: expected str, bytes or os.PathLike object, not NoneType
> 041237 PM
> prefect.flow_runs
Deployment_Prefect.yaml
prefect-version: 3.0.5
pull:
- prefect.deployments.steps.set_working_directory:
directory: /code
deployments:
- name: null
version: null
tags: []
description: null
schedule: {}
flow_name: null
entrypoint: null
parameters: {}
work_pool:
name: work-pool-dev
work_queue_name: eks-queue
job_variables:
image: 123456789012.dkr.ecr.us-east-1.amazonaws.com/mycontainer:latest
env:
APP_ENV: dev
poetry run prefect deploy /code/myflow.py:myflow -n dev -q eks-queue -p work-pool-dev --prefect-file /Deployment_Prefect.yamlDave D
10/09/2024, 8:26 PMkubectl get pods
never shows that the pod is createdDave D
10/09/2024, 8:27 PM