Hi! In prefect 1.X you could use Adjustments with ...
# ask-community
j
Hi! In prefect 1.X you could use Adjustments with Clocks, which was very useful for example to send an email daily (a daily report), but only for business days (excluding holidays too). What I did was to generate a clock signal daily and, with a custom adjustment, check if that day is business or not, and add X days to the datetime if it is not business day. Therefore, I receive every daily report but "delayed" those reports that are holidays to the next business day. Anyone knows how to do this using rrules? I see that this could be the only way to do that now in Prefect 2.X. Thank you in advance!
r
I would use an rrule BYDAY=MO,TU,WE,TH,FR so it only runs on a weekday then hit a holiday api (e.g https://api-ninjas.com/api/holidays to determine if it was an official holiday (as these change yearly)
j
Thank you @redsquare! But in that case, I would not receive emails for Saturday and Sunday. I still want to receive them, but on Monday (if it is not holiday). Also, if it is holiday, I assume you are suggesting to check the API in my flow, is that right? Thank you again!
r
you said only for business days?
send an email daily (a daily report), but only for business days
j
Yes, sorry for the misunderstanding. I want them every day, but only to be sent for business days
If it is not (weekend or holiday), to be delayed to the next business day
r
I am confused - what would Saturdays email contain
or you want Saturday & Sundays email on Monday?
j
That is, I want Saturday & Sundays email on Monday
I did that in Prefect 1.X with a daily clock and a custom function por Adjustment
r
Then I would have a flow that runs daily that creates the actual emailer flow run on the appropriate day
easier to reason with
j
That seems a nice solution, thank you!
I will try it :)
👍 1