eladkal opened a new issue, #61710:
URL: https://github.com/apache/airflow/issues/61710

   ### Body
   
   Some DAGs have strict logic of using intervals for processing (for example 
`{{ prev_data_interval_start_success }}` to `{{ data_interval_end }}` ). For 
such DAGs invoking manual runs will cause a problem as manual runs behave 
differently with intervals and scheduled runs do not reference them.
   This mostly becomes an issue when on-call who is not the DAG authors try to 
fix an issue or recover from a problem and isn't fully aware of the recover 
procedure for this specific DAG (need to clear a failure rather than triggering 
a new manual run).
   
   To avoid this problem I suggest to give Dag authors the ability to decide 
which dag run types are acceptable.
   Something like:
   
   ```
   from airflow.utils.types import DagRunType
   my_dag = DAG(
       ...,
       deny_dag_run_types = [DagRunType.MANUAL]
   )
   ```
   
   Where the default of `deny_dag_run_types` is to accept all run types. The 
interface/parameter name is just a suggestion.
   
   The expected behavior is for the UI/API to show a message that manual runs 
are not supported for this dag.
   
   After discussing with @guan404ming we'll need to break it down to the 
following:
   - Model: Add a deny_dag_run_types field to the dag model + DB migration.
   - API: Add validation in the trigger dag run endpoint to reject denied run 
types.
   - UI: Disable/hide the trigger button when MANUAL is denied, maybe with a 
tooltip explaining why.
   
   
   There may be edge cases that needs to be shown broken dag message. For 
example:
   
   ```
   from airflow.utils.types import DagRunType
   my_dag = DAG(
       ...,
       schedule=[example_asset]
       deny_dag_run_types = [DagRunType.ASSET_TRIGGERED]
   )
   ```
   as it make no sense to block asset triggering runs when the scheduling is 
per asset.
   
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to