David
08/10/2024, 7:24 PMMarvin
08/10/2024, 7:24 PM**kwargs
, but this might make the parameters appear less clear in the UI. Prefect allows specifying detailed parameter schemas to avoid using generic **kwargs
.
3. Updating Parameters in UI:
You can edit parameters directly from the Prefect UI. Go to the deployment details page and select Edit. Changes will be applied to all future flow runs based on the deployment.
4. Ad-Hoc Runs:
For custom parameter values during ad-hoc runs, navigate to the deployment details page, select Run, then Custom, and provide the new parameter values.
5. Pydantic Models:
Ensure your Pydantic models are correctly handled. If the UI still doesn't reflect the changes, verify your models are defined and imported correctly where needed.
Here's an example Flow to provide some context:
python
from prefect import flow
from pydantic import BaseModel, Field
class MyParams(BaseModel):
name: str
num: int
@flow
def my_flow(params: MyParams):
print(params.name, params.num)
if __name__ == "__main__":
from prefect.deployments import DeploymentSpec
DeploymentSpec(
flow=my_flow,
parameters={"params": {"name": "Marvin", "num": 42}},
name="my-flow-deployment"
)
You can refer to the full Prefect documentation on parameter configurations here:
* https://docs.prefect.io/latest/concepts/deployments-block-based/
* https://docs.prefect.io/latest/concepts/flows/
If you still encounter issues, you might want to ensure your Pydantic models are compatible and properly integrated. If problems persist, consider raising an issue on the Prefect GitHub repository.David
08/10/2024, 7:26 PMMarvin
08/10/2024, 7:27 PM