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

   ### Under which category would you file this issue?
   
   Providers
   
   ### Apache Airflow version
   
   3.2.1
   
   ### What happened and how to reproduce it?
   
   Issue 1:
   In the ui. If a dagrun has already succeeded we cannot "remark" it as 
succeeded. However through the API 
[`patch_dag_run`](https://airflow.apache.org/docs/apache-airflow/3.2.1/stable-rest-api-ref.html#operation/patch_dag_run),
 when sending a payload such as 
   ```
   {
           "state": "success",
           "note": note,
       }
   ```
   It allows dag to be "remarked" as success. This has the unwanted effect of 
marking tasks that in the initial dag run were skipped or failed, to now be 
shown as `success`. 
   
   
   Issue 2: 
   
   When marking through the ui a dagrun that is currently `running` as 
`success` and `failed` we get different results.
   - When doing `mark as failed` all the tasks that haven't yet been executed 
get skipped and the dag gets failed as `failed` - OK  - See Image 2
   - When doing `mark as success`, all the tasks, even the ones that have been 
previously executed and succeeded/ failed or got skipped change their status to 
success. - This is misleading, as a task that has already happened should not  
have its status changed - See Image 3
   
   
   
   Dag example. The ui is pressed once the dag is on `task_mark_dag_here`
   ```python
   from airflow.sdk import dag, task
   import time
   
   @dag
   def test_short_circuit_dag():
   
       @task.branch
       def task_branch():
           return "task_succeeds"
   
       @task
       def task_succeeds():
          pass
   
       @task
       def task_skipped():
          pass
   
       @task(trigger_rule="all_done")
       def task_fails_successfully():
           raise Exception
   
       @task(trigger_rule="one_failed")
       def task_succeeds2():
           pass
   
   
       @task
       def task_mark_dag_here():
           time.sleep(5)
       
       @task
       def task_not_executed():
           pass
   
       task_succeeds_1 = task_succeeds()
   
       task_branch() >> [task_succeeds_1, task_skipped()]
       task_succeeds_1 >> task_fails_successfully() >> task_succeeds2() >> 
task_mark_dag_here() >> task_not_executed()  >> task_not_executed() 
   
   test_short_circuit_dag()
   
   ```
   
   
   Image 1 - "Initial State"
   
   <img width="1460" height="245" alt="Image" 
src="https://github.com/user-attachments/assets/46823e11-055d-4e52-b3b6-e6797d8e0614";
 />
   
   Image 2 - Marking as Failed
   
   <img width="1458" height="238" alt="Image" 
src="https://github.com/user-attachments/assets/53b88f4f-666b-4a66-8333-ae374c12500a";
 />
   
   Image 3 - Marking as Success
   
   <img width="1440" height="219" alt="Image" 
src="https://github.com/user-attachments/assets/8c80fcb0-63f6-4c29-b6b9-4d6b35a65c96";
 />
   
   
   
   ### What you think should happen instead?
   
   Issue 1:
   if a dag has already `succeeded` sending a `patch_dag_rung` with the 
`"state": "success"` in the payload should not do anything.
   
   Issue 2: 
   If the dag is `running`, pressing mark as `success` should:
   - mark all next tasks as `skipped`
   - not alter states of tasks that already executed
   - mark dag as `success`
   
   ### Operating System
   
   _No response_
   
   ### Deployment
   
   None
   
   ### Apache Airflow Provider(s)
   
   _No response_
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Official Helm Chart version
   
   Not Applicable
   
   ### Kubernetes Version
   
   _No response_
   
   ### Helm Chart configuration
   
   _No response_
   
   ### Docker Image customizations
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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