Sayantani Bhattacharjee
08/28/2023, 2:56 PMprefect deploy
but it's not the easiest to parse through.Sayantani Bhattacharjee
08/28/2023, 2:57 PMNate
08/28/2023, 3:00 PMIn [1]: from prefect import get_client
In [2]: async with get_client() as client:
...: deployment = await client.read_deployment_by_name("foo/foo")
...: print(deployment.id)
...:
9ff2c2fc-f98e-4734-bda2-6c5c5331a136
Sayantani Bhattacharjee
08/29/2023, 6:06 PM<flow_name>/<deployment_name>
. My understanding of the flow_name is that it's either the value of the name argument passed in the @flow
decorator or the function name which is declared as the flow (only if the flow decorator does not have a value for the name argument).
Is there a way of extracting the name declared in the @flow
decorator after the flow is deployed? The reason I ask is that, for our scenario, we have our flow declaration in a dummy file `src/flow1.py` is as shown below:
@flow(name="Test flow")
def test_flow():
...
and our deployment section to the flow in prefect.yaml is as follows:
{"name": "test_flow_deploy1"
"entrypoint": "src/flow1.py:test_flow"
...}
In the above case, when we deploy our flow, the deployment name will be Test flow/test_flow_deploy1
and according to your example, we will need to provide this entire deployment name to get the flow ID.
That is a bit of a blocker for us as the flow_name section of the deployment_name is not referred anywhere else other than while declaring the flow decorator. Does flow decorator have some metadata that we could perhaps leverage for our use-case?Nate
08/29/2023, 6:41 PMMy understanding of the flow_name is that it's either the value of the name argument passed in thecorrect! you can see what the api has stored if you do a quickdecorator or the function name which is declared as the flow (only if the flow decorator does not have a value for the name argument).@flow
prefect deployment ls
- there's a few different ways to fetch that reliably, you can use client.read_deployments
- are you having to dynamically discover the flow name supplied to the @flow
decorator??Sayantani Bhattacharjee
08/29/2023, 9:01 PMprefect deploy
runs successfully)