File size: 1,020 Bytes
1e732dd
 
 
 
 
 
 
 
 
 
 
 
696f787
 
1e732dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
MediGuard AI — Airflow DAG: SOP Evolution Cycle

Runs the evolutionary SOP optimisation loop periodically.
"""

from __future__ import annotations

from datetime import datetime, timedelta

from airflow.operators.python import PythonOperator

from airflow import DAG

default_args = {
    "owner": "mediguard",
    "retries": 1,
    "retry_delay": timedelta(minutes=10),
    "email_on_failure": False,
}


def _run_evolution(**kwargs):
    """Execute one SOP evolution cycle."""
    from src.evolution.director import run_evolution_cycle

    result = run_evolution_cycle()
    print(f"Evolution cycle complete: {result}")
    return result


with DAG(
    dag_id="mediguard_sop_evolution",
    default_args=default_args,
    description="Run SOP evolutionary optimisation",
    schedule="@weekly",
    start_date=datetime(2025, 1, 1),
    catchup=False,
    tags=["mediguard", "evolution"],
) as dag:
    evolve = PythonOperator(
        task_id="run_sop_evolution",
        python_callable=_run_evolution,
    )