Skip to content

Commit

Permalink
set executor.job_id to BackfillJob.id for backfills (#27020)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Hatter <ryan.hatter@astronomer.io>
  • Loading branch information
RNHTTR and RNHTTR committed Oct 23, 2022
1 parent 3a41476 commit 57bb54d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion airflow/jobs/backfill_job.py
Expand Up @@ -833,7 +833,7 @@ def _execute(self, session=None):
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
Expand Down
6 changes: 3 additions & 3 deletions tests/jobs/test_backfill_job.py
Expand Up @@ -1609,8 +1609,8 @@ def test_job_id_is_assigned_to_dag_run(self, dag_maker):
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()

Expand All @@ -1624,7 +1624,7 @@ def test_backfill_has_job_id(self):
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"])
Expand Down

0 comments on commit 57bb54d

Please sign in to comment.