This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit d4e51861f353e48dc22b4d7e7b91073e787e0ac9
Author: Ryan Hatter <[email protected]>
AuthorDate: Sun Oct 23 11:12:30 2022 -0400

    set executor.job_id to BackfillJob.id for backfills (#27020)
    
    Co-authored-by: Ryan Hatter <[email protected]>
    (cherry picked from commit 57bb54d458aec4bea6977b2e410107df4c281de6)
---
 airflow/jobs/backfill_job.py    | 2 +-
 tests/jobs/test_backfill_job.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/airflow/jobs/backfill_job.py b/airflow/jobs/backfill_job.py
index 62bc8c2bb3..018a70ea8e 100644
--- a/airflow/jobs/backfill_job.py
+++ b/airflow/jobs/backfill_job.py
@@ -833,7 +833,7 @@ class BackfillJob(BaseJob):
             pickle_id = pickle.id
 
         executor = self.executor
-        executor.job_id = "backfill"
+        executor.job_id = self.id
         executor.start()
 
         ti_status.total_runs = len(dagrun_infos)  # total dag runs in backfill
diff --git a/tests/jobs/test_backfill_job.py b/tests/jobs/test_backfill_job.py
index 18fa630835..2071f56c37 100644
--- a/tests/jobs/test_backfill_job.py
+++ b/tests/jobs/test_backfill_job.py
@@ -1609,8 +1609,8 @@ class TestBackfillJob:
         dr: DagRun = dag.get_last_dagrun()
         assert dr.creating_job_id == job.id
 
-    def test_backfill_has_job_id(self):
-        """Make sure that backfill jobs are assigned job_ids."""
+    def test_backfill_has_job_id_int(self):
+        """Make sure that backfill jobs are assigned job_ids and that the 
job_id is an int."""
         dag = self.dagbag.get_dag("test_start_date_scheduling")
         dag.clear()
 
@@ -1624,7 +1624,7 @@ class TestBackfillJob:
             run_backwards=True,
         )
         job.run()
-        assert executor.job_id is not None
+        assert isinstance(executor.job_id, int)
 
     @pytest.mark.long_running
     @pytest.mark.parametrize("executor_name", ["SequentialExecutor", 
"DebugExecutor"])

Reply via email to