Flows can’t have a schedule in server (same in clo...
# prefect-community
a
Flows can’t have a schedule in server (same in cloud?) if they have required parameters, right?
z
Hi @Alex Cano, correct! If you want to relax that restriction a bit, you can provide parameter defaults on the schedule itself, like in the link below. https://docs.prefect.io/core/concepts/schedules.html#varying-parameter-values
a
Gotcha! Is there an idiomatic way to not allow “incompletely parameterized” ad-hoc runs of the flow? Like say there’s a parameter,
date
, that is automatically populated by a clock, which is great since it won’t ever be malformed. But you’d still be able to create ad-hoc flow runs of this flow without that parameter being filled in correctly, right? Could we apply a “parameter default” onto the Flow’s parameters itself and make the parameter required?
z
Testing this out-- will be back to you in a jiff!
👍 1
Back with some results! If you define defaults with your schedule, you can in fact manually schedule a run. If not otherwise provided, the value of that parameter will be null. Since
default
and
required
are mutually exclusive when defined for the parameter itself, I think the best way to handle this would be to define your default(s) on your schedule, but to make the parameter required. By doing so, you'd ensure that all scheduled runs are correctly parametrized, but that any manual runs can't be run in an "incompletely parametrized" state.
upvote 1
a
Gotcha, that makes sense! Thanks for the help!
🎉 1
z
Sure thing!