Ben Muller
11/17/2022, 12:57 AM@flow
def my_flow(
start: str = (datetime.utcnow() - timedelta(days=7)).strftime("%Y-%m-%d"),
end: str = datetime.utcnow().strftime("%Y-%m-%d"),
):
Will these default parameters be set at deploy time or will they update at run time ?Ryan Peden
11/17/2022, 1:29 AMPrefectFuture
the flow needs to wait for.
If you wanted to set default values set at deploy time instead, you could do it using parameters
in a Python deployment, e.g.:
my_deployment = Deployment.build_from_flow(
# other args,
parameters={
"start": (datetime.utcnow() - timedelta(days=7)).strftime("%Y-%m-%d"),
"end": datetime.utcnow().strftime("%Y-%m-%d")
}
)
You could also set them in a CLI deployment using the --param
or --params
flags but you'd need to generate the values using shell commands instead of Python. Run prefect deployment build --help
if you'd like to see usage instructions for these flags. 🇦🇺 🇨🇦Ben Muller
11/17/2022, 1:30 AMRyan Peden
11/17/2022, 1:37 AMBen Muller
11/17/2022, 1:42 AMRyan Peden
11/17/2022, 2:03 AM21:00:13.695 | INFO | prefect.agent - Submitting flow run '1db73ea5-0884-4b77-8ffb-50a949226cc9'
21:00:13.814 | INFO | prefect.infrastructure.process - Opening process 'eccentric-jackal'...
21:00:13.826 | INFO | prefect.agent - Completed submission of flow run '1db73ea5-0884-4b77-8ffb-50a949226cc9'
21:00:16.215 | INFO | Flow run 'eccentric-jackal' - Finished in state Completed()
start is 2022-11-10-02:00:15
end is 2022-11-17-02:00:15
21:00:16.448 | INFO | prefect.infrastructure.process - Process 'eccentric-jackal' exited cleanly.
21:00:49.034 | INFO | prefect.agent - Submitting flow run 'fed027d3-4daf-4174-89e8-7d75689de37d'
21:00:49.118 | INFO | prefect.infrastructure.process - Opening process 'striped-waxbill'...
21:00:49.124 | INFO | prefect.agent - Completed submission of flow run 'fed027d3-4daf-4174-89e8-7d75689de37d'
21:00:51.787 | INFO | Flow run 'striped-waxbill' - Finished in state Completed()
start is 2022-11-10-02:00:51
end is 2022-11-17-02:00:51
21:00:52.060 | INFO | prefect.infrastructure.process - Process 'striped-waxbill' exited cleanly.
21:01:04.212 | INFO | prefect.agent - Submitting flow run 'd671317f-f0f0-4833-8075-caceee7c9d15'
21:01:04.315 | INFO | prefect.infrastructure.process - Opening process 'cherubic-skunk'...
21:01:04.324 | INFO | prefect.agent - Completed submission of flow run 'd671317f-f0f0-4833-8075-caceee7c9d15'
21:01:06.813 | INFO | Flow run 'cherubic-skunk' - Finished in state Completed()
start is 2022-11-10-02:01:06
end is 2022-11-17-02:01:06
which looks like it is what you want. Or if I misunderstood and you want them set at deploy time, the code I showed for that should work too; those values would show up in the Overrides column in the UI.Ben Muller
11/17/2022, 2:29 AMZanie
11/17/2022, 2:59 AMBen Muller
11/17/2022, 3:26 AMZanie
11/17/2022, 6:15 AMBen Muller
11/17/2022, 6:16 AMRyan Peden
11/17/2022, 2:06 PM