Victor
03/03/2025, 9:11 PM# Prefect version, path: clients/GOOGLE/test_flow/prefect.yaml
prefect-version: 3.2.9 # Replace with the Prefect version you're using
name: test-flow
pull:
- prefect.deployments.steps.git_clone:
id: clone-step # needed to be referenced in subsequent steps
repository: <https://github.com/user/codebase.git>
credentials: '{{ prefect.blocks.github-credentials.github-credential-user }}'
- prefect.deployments.steps.pip_install_requirements:
id: requirements-step
directory: clients/GOOGLE/test_flow
requirements_file: requirements.txt
# Deployment configurations
deployments:
- name: test-flow-github-deploy
entrypoint: flows/test_flow.py:test_flow
work_pool:
name: default-pool
work_queue_name:
job_variables: {}
schedule:
parameters:
version: '0.1'
tags: []
concurrency_limit:
description:
schedules: []
my run fails because its expecting flows/test_flow.py
to be at root of repo where as it is inside clients/GOOGLE/test_flow
, the same location as requirements.txt
and my prefect.yaml
for this flow deploy.
if I change entrypoint to ``clients/GOOGLE/test_flow/flows/test_flow.py`` then the deploy fails since it runs entrypoint relative to prefect.yaml path.
here is the dir struct:
repo_root:
- clients/GOOGLE/test_flow/flows
- clients/GOOGLE/test_flow/tasks
- clients/GOOGLE/test_flow/prefect.yaml
- clients/GOOGLE/test_flow/requirements.txt
- clients/YAHOO/test_flow/flows
- clients/YAHOO/test_flow/tasks
- clients/YAHOO/test_flow/prefect.yaml
- clients/YAHOO/test_flow/requirements.txt
endgoal is to use one repo to manage all clients flows, how do I set directory inside deployments if my yaml files are inside each client folders?Nate
03/03/2025, 9:59 PM--prefect-file
flag for prefect deploy
?
you could check out this example
https://github.com/zzstoatzz/prefect-pack/tree/main/flows/be_modal
where im following a couple hard rules
• always run prefect deploy
from repo root
• always specify entrypoint
relative to repo root
because this example was motivated by a user who wanted to run make deploy
from within their specific folder, the make
command cd's out to root
you might want to plus 1 this issue, as it would relax that second rule above and perhaps make setups like yours easier to reason aboutVictor
03/03/2025, 10:59 PM-prefect-file
arg worked but was facing issues with tasks import failure in flows due to path issues. I was able to add ___init___.py
to all folders to make them python module and then refer to tasks folder using root reference. Thank you so much for the help.Nate
03/03/2025, 11:02 PMVictor
03/04/2025, 1:17 AMfrom tasks.download_reports import generate_and_download_pdfs
but if I update it to:
from clients.GOOGLE.test_flow.tasks.download_reports from generate_and_download_pdfs
it stops working locally and I am unable to test things. same goes with my utils folder.Nate
03/04/2025, 1:22 AM» uv sync
Resolved 136 packages in 1ms
Audited 132 packages in 0.28ms
» uv run python -c "from prefect_pack.utils import parse_as;print(parse_as)"
<function parse_as at 0x104e172e0>
so i'm using uv
(which I'd recommend) but you can use pip install .
as i mention in the readme and this way you have a static and unambiguous import, from your_package.submodule import your_thing
so whether you do the pip install .
in your dockerfile or in a pull
step or something, that's up to you, but I would build a python package so your imports are consistent