Prasanth345 opened a new pull request, #53927:
URL: https://github.com/apache/airflow/pull/53927

   ## Overview
   
   This PR fixes a crash in the Apache Airflow `EdgeExecutor` caused by 
duplicate entries in the `edge_job` table when handling deferrable tasks like 
`ExternalTaskSensor(mode="reschedule")`.
   
   ---
   
   ## Root Cause
   
   When a deferrable task times out and retries, both `execute_async()` and 
`queue_workload()` attempt to insert the same job into the `edge_job` table 
again, violating uniqueness constraints and causing the scheduler to crash.
   
   ---
   
   ## Solution
   
   Instead of blindly inserting, both methods now:
   
   - Check if a matching job exists (`dag_id`, `task_id`, `run_id`, 
`map_index`, `try_number`)
   - If it exists → **Update** the job to reflect the latest state
   - If not → Insert a new record
   
   This preserves job queue integrity and ensures tasks are picked up correctly 
by the edge worker.
   
   ---
   
   ## Changes Made
   
   - Patched `execute_async()` and `queue_workload()` in:
     
`airflow/providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py`
   
   ---
   
   ## Related Issue
   
   Closes [#53610](https://github.com/apache/airflow/issues/53610)
   


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