Pooyan
02/08/2024, 6:49 PMapi/deployments
endpoint to create a new deployment. It turns out it does not accept flow_name
in the body whereas flow_id
does not exist at this point. I can use prefect python sdk to pass flow_name to Deployment and do apply and am wondering how that works with the rest apiMarvin
02/08/2024, 6:50 PMflow_name
not being accepted in the api/deployments
endpoint on Prefect's GitHub repository. However, it's important to know that creating deployments via the Prefect REST API can be different from how the Python SDK operates.
Here's a summary of how deployments work with respect to flow names and IDs:
1. Flow Name vs. Flow ID:
- When you create a flow via the Python SDK, you typically give it a name.
- Once a flow is registered with the Prefect server, it is assigned a unique flow_id
that you can use to reference it.
2. Deployments: Creating a deployment involves referencing an existing flow. You need the flow_id
of the already registered flow to create a deployment for it. That is why the API expects a flow_id
instead of flow_name
.
3. API vs. SDK: The Python SDK might abstract away some of these details, allowing you to specify a flow_name
when creating a Deployment object, but internally it probably resolves this flow_name
to the corresponding flow_id
.
For REST API:
- If you’re creating flows programmatically, consider first registering the flow to obtain its flow_id
. You can then proceed to create a deployment using that flow_id
.
- Make sure that when you register your flows, you keep track of their flow_id
to use them later in your deployments.
If you're encountering a problem and need more details on how to programmatically achieve this or if you believe that your issue is an actual bug or missing feature, you might want to create an issue in the Prefect GitHub repository to get more tailored assistance from the Prefect community.Nate
02/08/2024, 8:18 PMPooyan
02/08/2024, 9:04 PMNate
02/08/2024, 9:04 PM