https://prefect.io logo
Title
r

Rajvir Jhawar

08/03/2022, 7:07 AM
Version:             2.0.2
API version:         0.8.0
Python version:      3.9.13
I having problems with both the
read_flow_by_name
and
read_deployment_by_name
. Neither of these method is working in when i try to use them: Sample code:
from prefect.client import get_client
import asyncio
import json
async def main():
async with get_client() as client:
data = await client.read_flow_by_name(flow_name='test_flow')
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Error:
Traceback (most recent call last):
File
data = await client.read_flow_by_name(flow_name='test_flow')
/.venv/lib/python3.9/site-packages/prefect/client.py", line 508, in read_flow_by_name
return schemas.core.Deployment.parse_obj(response.json())
File "pydantic/main.py", line 521, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 2 validation errors for Deployment
flow_id
field required (type=value_error.missing)
manifest_path
field required (type=value_error.missing)
1
Am I doing something wrong here?
If you use the non name version of the functions it works
r

Rio McMahon

08/09/2022, 3:10 AM
+1 to this - @Anna Geller I am experiencing similar issues
Experiencing similar with
Version:             2.0.3
API version:         0.8.0
Python version:      3.7.13
Git commit:          2f1cf4ac
Built:               Fri, Aug 5, 2022 3:57 PM
OS/Arch:             darwin/x86_64
Profile:             goodkiwi
Server type:         hosted
r

Rajvir Jhawar

08/09/2022, 6:36 AM
@Rio McMahon
read_flow_by_name
had a bug in it which resolved by the team based on a bug report i submitted, see here: https://github.com/PrefectHQ/prefect/pull/6225 The
read_deployment_by_name
function take in "full" deployment name so <flow_name>/<deployment_name> --> it is a little weird that you need to provide the "full name" but that what it takes in.
:thank-you: 1
r

Rio McMahon

08/09/2022, 12:54 PM
@Rajvir Jhawar - thanks for the clarification; I saw the slash in the documentation and thought that meant either or