https://prefect.io logo
Title
g

gertjan

09/06/2022, 10:20 AM
Hi everyone quite new to prefect and testing something out but I’m stuck,. I want to use
Deployment.build_from_flow
, it works when I put this in the same directory of the
flows
But what I want is the following:
- deployments:
   -- deployments.py (file with all my deployments)
- flows:
   -- flow_a.py
   -- flow_b.py
When I generate the deployments I get:
ValueError: '..../updates/flows/flow_a.py' is not in the subpath of '.../updates/deployments' OR one path is relative and the other is absolute.
It has to do with this line
entry_path = Path(flow_file).absolute().relative_to(Path(".").absolute())
-> it does not look like I can edit this β€œpath” Anyone has done this before? Is this even possible?
βœ… 1
a

Anna Geller

09/06/2022, 10:38 AM
Can you try the same using prefect deployment build CLI? CLI is much easier
g

gertjan

09/06/2022, 10:41 AM
From the CLI I can make it work. But it looks handy to have all the deployments bundled in the project as Python Object
a

Anna Geller

09/06/2022, 10:43 AM
have you seen this repository? I also wrote a blog post about it here. I consider CLI to be best practice, but both options are there
g

gertjan

09/06/2022, 10:47 AM
Thanks for the response! https://github.com/anna-geller/dataflow-ops/blob/main/deploy_cli/hello.bash This makes sense πŸ’ƒ
πŸ™Œ 1
a

Anna Geller

09/06/2022, 10:51 AM
Actually, now you could even have just one line per flow:
prefect deployment build --name s3 -q prod -sb s3/prod -v GITHUB_SHA --apply flows/flow1.py:flow1

prefect deployment build --name s3 -q prod -sb s3/prod -v GITHUB_SHA --apply flows/flow2.py:flow2

prefect deployment build --name s3 -q prod -sb s3/prod -v GITHUB_SHA --apply flows/flow3.py:flow3
πŸ™Œ 1