In prefect I would like to run flows with parameters on schedule. That sounds very natural to pass parameters, e.g. db credentials, right?
I have created a flow with parameters that runs well as prefect run -p flow.py --param db_config_path=somepath
, now I would like to register it as prefect register --project project_name --path flow.py --name somename
(with server started and agent running) to run on schedule.
However the server says:
graphql_1 | {"severity": "ERROR", "name": "prefect-server.api.flows", "message": "Failed to set schedule to active while creating flow (flow_id={flow_id}).", "exc_info": "Traceback (most recent call last):\n File "/prefect-server/src/prefect_server/api/flows.py", line 285, in create_flow\n await api.flows.set_schedule_active(flow_id=flow_id)\n File "/prefect-server/src/prefect_server/api/flows.py", line 564, in set_schedule_active\n raise ValueError("Can not schedule a flow that has required parameters.")\nValueError: Can not schedule a flow that has required parameters."}
Moreover I found this:
https://github.com/PrefectHQ/prefect/issues/380
So it seems that flows with parameters are out of prefect paradigm? How do I pass db creds to the flows in this case?
Couple of things:
PrefectSecret
task. On Server, you need to store local secrets. You can also see more on that hererequired=False
so that you can register without a default.