Skip to content

Commit

Permalink
Test process executor events with different try_number
Browse files Browse the repository at this point in the history
  • Loading branch information
tanelk authored and potiuk committed Jun 14, 2022
1 parent 8b21a50 commit 6c20124
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/jobs/test_scheduler_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,20 @@ def test_process_executor_events_ti_requeued(self, mock_stats_incr, mock_task_ca
self.scheduler_job.id = 1
self.scheduler_job.processor_agent = mock.MagicMock()

# ti is queued with another try number - do not fail it
ti1.state = State.QUEUED
ti1.queued_by_job_id = 1
ti1.try_number = 2
session.merge(ti1)
session.commit()

executor.event_buffer[ti1.key.with_try_number(1)] = State.SUCCESS, None

self.scheduler_job._process_executor_events(session=session)
ti1.refresh_from_db(session=session)
assert ti1.state == State.QUEUED
self.scheduler_job.executor.callback_sink.send.assert_not_called()

# ti is queued by another scheduler - do not fail it
ti1.state = State.QUEUED
ti1.queued_by_job_id = 2
Expand Down

0 comments on commit 6c20124

Please sign in to comment.