Skip to content

AWS MWAA: DAG didn't start according to schedule, but run well if to start it manually

0

I've created a DAG (not really complicated). Schedule: "0 6 1 * *" (At 06:00 on day-of-month 1 EST). So, when I tested it, I manually started it and it worked well.

from datetime import datetime
from datetime import timedelta

from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.utils.trigger_rule import TriggerRule

import pendulum

from scripts.helpers.slack import slack_notification
from scripts.helpers.slack import slack_notification_dag_fail
from scripts.helpers.slack import slack_notification_task_fail
from scripts.models import AIRFLOW_DAG_RETRIES
from scripts.models import AIRFLOW_DAG_RETRIES_DELAY

est_tz = pendulum.timezone("America/New_York")

with DAG(
    "AAA_data_extraction",
    start_date=datetime(2025, 6, 9, tzinfo=est_tz),
    schedule_interval="0 6 1 * *",
    catchup=False,
    max_active_runs=1,
    concurrency=1,
    on_failure_callback=slack_notification_dag_fail,
) as dag:
    from scripts.AAA_script import A
    from scripts.AAA_script import B

    A = PythonOperator(
        task_id="A",
        provide_context=True,
        python_callable=A,
        on_failure_callback=slack_notification_task_fail,
        retries=AIRFLOW_DAG_RETRIES,
        retry_delay=timedelta(minutes=AIRFLOW_DAG_RETRIES_DELAY),
        dag=dag
    )

    B = PythonOperator(
        task_id="B",
        provide_context=True,
        python_callable=B,
        on_failure_callback=slack_notification_task_fail,
        retries=AIRFLOW_DAG_RETRIES,
        retry_delay=timedelta(minutes=AIRFLOW_DAG_RETRIES_DELAY),
        dag=dag
    )
A >> B

Then I published it, but on the first day of the next month it didn't start at all. No logs, no errors. The only thing I found suspicious was warning logs which appeared before the first of month:

{processor.py:186} INFO - Started process (PID=63504) to work on /usr/local/airflow/dags/scripts/AAA_script.py
{processor.py:914} INFO - Processing file /usr/local/airflow/dags/scripts/AAA_script.py for tasks to queue
{dagbag.py:588} INFO - Filling up the DagBag from /usr/local/airflow/dags/scripts/AAA_script.py
{processor.py:927} WARNING - No viable dags retrieved from /usr/local/airflow/dags/scripts/AAA_script.py
1 Answer
0

It appears your DAG isn't running on schedule despite working correctly when triggered manually. This issue could be related to a few common scheduler problems in Amazon MWAA.

First, the warning logs you're seeing indicate that the scheduler is not recognizing your AAA_script.py as a valid DAG file. This is likely because this file contains your helper functions (A and B) but not the actual DAG definition. The DAG definition appears to be in a different file that imports these functions.

There are several potential causes for your scheduler issue:

  1. Scheduler health issues: The scheduler might not be running properly. If the scheduler doesn't send a heartbeat within the scheduler_health_check_threshold (default 30 seconds), it's considered unhealthy and won't schedule new tasks.

  2. Networking issues: Check that your VPC security group allows inbound access to port 5432, which is needed to connect to the Amazon Aurora PostgreSQL metadata database for your environment.

  3. Dependency installation failures: Ensure that all required Python modules are correctly installed and compatible.

  4. Overloaded scheduler: If your scheduler CPU and memory utilization is too high (above 90%), it might not function properly.

  5. Start date configuration: Your DAG has a start_date set to June 9, 2025, which is in the future. With catchup=False, the scheduler won't run this DAG until that date is reached. You might want to set the start_date to a date in the past.

To troubleshoot:

  • Check CloudWatch Logs for scheduler issues
  • Verify your VPC security group settings
  • Consider modifying the start_date to be in the past
  • Ensure your DAG file structure is correct and that the scheduler can properly parse your DAG

Since the DAG runs correctly when triggered manually, the issue is most likely with how the scheduler is interacting with your DAG rather than with the DAG's logic itself.
Sources
Resolve common scheduler issues in Amazon MWAA | AWS re:Post
Troubleshooting: DAGs, Operators, Connections, and other issues in Apache Airflow v2 - Amazon Managed Workflows for Apache Airflow
Troubleshooting: DAGs, Operators, Connections, and other issues in Apache Airflow v1 - Amazon Managed Workflows for Apache Airflow

answered 10 months ago
  • AI says: "Your DAG has a start_date set to June 9, 2025, which is in the future. " Today is July 9, 2025. So, it's not in the future. It was a month ago...

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.