Kartik
02/17/2026, 6:25 AMMarvin
02/17/2026, 6:26 AMMarvin
02/17/2026, 6:31 AMfrom prefect import flow, task, get_run_logger
@task
def run_dbt_models():
# your dbt logic here
...
@task
def daily_only_task():
# your once-per-day logic here
...
@flow
def store_workflow(run_daily: bool = False):
logger = get_run_logger()
# always run your regular tasks
run_dbt_models()
# only run this when the schedule sets run_daily=True
if run_daily:
<http://logger.info|logger.info>("Running daily-only task")
daily_only_task()
else:
<http://logger.info|logger.info>("Skipping daily-only task")
prefect.yaml (one deployment, two schedules):
deployments:
- name: store-prod
entrypoint: workflow.py:store_workflow
parameters:
run_daily: false
work_pool:
name: your-pool
schedules:
- interval: 1800 # every 30 minutes
slug: every-30m
active: true
parameters:
run_daily: false
- cron: "0 2 * * *" # once per day at 02:00 UTC
timezone: "UTC"
slug: daily
active: true
parameters:
run_daily: true
Notes:
- A single deployment can have multiple schedules; each schedule can provide its own parameters. Schedule parameters override deployment defaults for those runs.
- This avoids creating a second deployment and ensures your “daily-only” task runs just once per day while the rest of the flow continues every 30 minutes.
- You can manage schedules in YAML (recommended), via the UI, or with the CLI. If you edit YAML, re-run prefect deploy.
Docs:
- Create schedules
- prefect.yaml reference
Quick question to confirm the branching you want:
- On the daily run, should the dbt tasks also run (plus the daily-only task), or do you want only the daily-only task to run? If it’s “only the daily task,” we can add another parameter (e.g., mode: "regular"|"daily") and conditionally skip the dbt section too.
If you paste your current workflow.py and prefect.yaml, I can tailor the exact edits.