Hey again,
I want to run my flow on schedule, So I’m using this guide - https://docs.prefect.io/core/tutorial/05-running-on-a-schedule.html
It will run every day and will get the relevant data from an API (each time for the last day).
From time to time I would like to run it manually and give it parameters at the UI level (the motivation is getting data for an interval of dates and not just a single one - My DS team may ask for data of a full year).
Is there any way to do both stuff with exactly the same code? Something like “if env_vars is None: run_with_sched else run_with_env_vars”
Thanks
k
Kevin Kho
11/18/2021, 2:48 PM
Hey @Dekel R, I don’t think there is anything in the context that gives this to you. But yes I think there are some ways to do this.
1. You can use a parameter to change the logic of the flow to backfill. Set the default to the current date. They can then change what date to get data from.
2. A bit more complicated, you could set the env vars in the RunConfig under the advanced section in the UI
d
Dekel R
11/24/2021, 10:02 AM
Hey,
Thanks for your answer - I ended up doing it with parameters - the parameters are “None” by default, so in a schedule run they just get the current date.
When running manually I add them as inputs.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.