<@ULVA73B9P> is there a way to set up an automatio...
# marvin-ai
м
@Marvin is there a way to set up an automation that will fire only on event at monday?
m
thought for 96.6 seconds
Not directly. In Prefect 3.x, automations are event-driven, but they do not have a built-in "only on Mondays" day-of-week filter in the trigger itself. What to do instead Option 1: Best practice — use a Monday schedule upstream If you want something to happen only on Mondays, the cleanest pattern is: 1. Schedule a deployment to run on Mondays 2. Have the automation react to that deployment's event For example, a deployment schedule like:
Copy code
yaml
schedule:
  cron: "0 9 * * 1"
  timezone: "UTC"
or with an RRULE:
Copy code
yaml
schedule:
  rrule: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0;BYSECOND=0"
  timezone: "America/New_York"
Then your automation can listen for something like
prefect.flow-run.Completed
from that deployment. Relevant docs: - Schedules - Automations - Event triggers Option 2: Emit a custom event only on Mondays If the event source is under your control, you can check the weekday in your flow/code and emit a custom event only when it's Monday. Then the automation listens for that custom event. Conceptually:
Copy code
python
from datetime import datetime

if datetime.now().weekday() == 0:  # Monday
    # emit custom event here
    ...
Important distinction - Schedules handle calendar logic like "Monday at 9am" - Automations handle reacting to events So if your goal is "run this only on Mondays," use a schedule. If your goal is "when event X happens, react only if today is Monday," you'd need to enforce that in the event-producing code or in the triggered flow logic. If you want, I can show you the exact setup for either: - a deployment + automation pattern, or - a custom event pattern.
n
@Marvin can you do some research and create a discussion w a proposal for extending automations to allow this?
m
Error: GitHub authentication failed
Sorry, I encountered an error while processing your request. Please try again.
n
old fashioned way it is! (need to rotate auth token)