GitHub user kaminagakur4 added a comment to the discussion: Manually Triggering 
a Paused DAG

@raphaelauv is right that the scheduler will not touch a paused DAG, and right 
that no config changes it. Those filters are hardcoded with no conf lookup: in 
3.1.3, `dagrun.py:618` has `DagModel.is_paused == false()` and 
`scheduler_job_runner.py:400` has `~DM.is_paused`. But there is one path that 
runs outside the scheduler entirely:

```bash
airflow dags test <dag_id>
```

I tested this on 3.1.3. With `is_paused = True` and no scheduler process 
running at all, both tasks executed, the DagRun finished `success`, and 
`airflow dags list` still showed `is_paused: True` afterwards. `DAG.test()` 
creates the run and executes the tasks inside the CLI process, and there is no 
`is_paused` check anywhere in that path.

Two caveats before you lean on it. This is not a documented guarantee. The 
command is supported as a debugging tool, and the 3.1.3 debug docs do not 
mention paused DAGs at all, so treat running-while-paused as behavior that 
could change. It also needs a shell where the dags folder and the metadata DB 
config both live, so on a managed service like MWAA or Composer the subcommand 
may not be exposed to you.

Two other things worth knowing either way. `airflow dags trigger` on a paused 
DAG is not a no-op: it creates the run, the run sits in `queued`, and it starts 
the moment you unpause. And backfill does not get around the pause in Airflow 
3. It has been scheduler driven since AIP-78, so it goes through the same query 
above. That is a change from 2.x.

If the reason for pausing is only to stop it running on a schedule, then pause 
is the wrong lever. `schedule=None` on an unpaused DAG gives you manual-only 
triggering without keeping a duplicate DAG around.

One last note if you use the UI: when a DAG is paused the trigger dialog shows 
"Unpause on trigger" and that box is checked by default, so triggering from the 
UI unpauses unless you uncheck it.


GitHub link: 
https://github.com/apache/airflow/discussions/71353#discussioncomment-18042664

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to