Skip to content

Commit 425c500

Browse files
author
Oleksandr Bazarnov
committed
fix test
1 parent 0a6b0f2 commit 425c500

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

airbyte_cdk/sources/declarative/async_job/job_orchestrator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,15 +382,15 @@ def _stop_partition(self, partition: AsyncPartition) -> None:
382382

383383
def _stop_timed_out_jobs(self, partition: AsyncPartition) -> None:
384384
for job in partition.jobs:
385-
if job.status() == AsyncJobStatus.TIMED_OUT:
386-
# we don't free allocation here because it is expected to retry the job
387-
self._abort_job(job, free_job_allocation=False)
388-
elif job.status() == AsyncJobStatus.FORCED_TIME_OUT:
385+
if job.status() == AsyncJobStatus.FORCED_TIME_OUT:
389386
self._abort_job(job, free_job_allocation=True)
390387
raise AirbyteTracedException(
391388
internal_message=f"Job {job.api_job_id()} has timed out. Try increasing the `polling job timeout`.",
392389
failure_type=FailureType.config_error,
393390
)
391+
# we don't free allocation here because it is expected to retry the job
392+
if job.status() == AsyncJobStatus.TIMED_OUT:
393+
self._abort_job(job, free_job_allocation=False)
394394

395395
def _abort_job(self, job: AsyncJob, free_job_allocation: bool = True) -> None:
396396
try:

unit_tests/sources/declarative/async_job/test_job.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def test_given_timer_is_not_out_when_status_then_return_actual_status(self) -> N
1919
job = AsyncJob(_AN_API_JOB_ID, _ANY_STREAM_SLICE, _A_VERY_BIG_TIMEOUT)
2020
assert job.status() == AsyncJobStatus.RUNNING
2121

22-
def test_given_timer_is_out_when_status_then_return_timed_out(self) -> None:
22+
def test_given_timer_is_out_when_status_then_return_forced_time_out(self) -> None:
2323
job = AsyncJob(_AN_API_JOB_ID, _ANY_STREAM_SLICE, _IMMEDIATELY_TIMED_OUT)
2424
time.sleep(0.001)
25-
assert job.status() == AsyncJobStatus.TIMED_OUT
25+
assert job.status() == AsyncJobStatus.FORCED_TIME_OUT
2626

2727
def test_given_status_is_terminal_when_update_status_then_stop_timer(self) -> None:
2828
"""

0 commit comments

Comments
 (0)