-
Notifications
You must be signed in to change notification settings - Fork 33
fix: (CDK) (AsyncRetriever) - fix bug when TIMEOUT Jobs are retried, ignoring the polling_job_timeout setting
#429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes an issue where TIMEOUT jobs were being retried despite the polling job timeout setting, while also adding enhanced context interpolation for HTTP job responses.
- In job_orchestrator.py, TIMEOUT jobs are now treated as terminal with improved error messaging and allocation freeing.
- New helper methods have been added in http_job_repository.py to generate interpolation contexts for creation and polling responses.
- The related test has been updated to assert the new timeout error message.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| airbyte_cdk/sources/declarative/async_job/job_orchestrator.py | Updated logic to avoid re-queuing TIMEOUT jobs and improved error handling and cleanup, along with new helper methods for partition job management. |
| airbyte_cdk/sources/declarative/requesters/http_job_repository.py | Added methods for generating interpolation contexts for job responses, maintaining consistency in extra_fields. |
| unit_tests/sources/declarative/async_job/test_job_orchestrator.py | Modified test to capture and assert the updated timeout error message. |
📝 WalkthroughWalkthroughThis pull request updates the asynchronous job orchestration and HTTP job repository logic. In the orchestrator, job status handling is refined to distinguish between FAILED and TIMED_OUT states. New methods remove completed or timed-out jobs and reallocate partitions for failed jobs, while error reporting for timeouts is enhanced. The HTTP job repository now centralizes response context creation with dedicated methods for job creation and polling, streamlining the data extraction process. The unit test has been adjusted to focus on validating the proper error message when a job times out. Changes
Sequence Diagram(s)Async Job Orchestration FlowsequenceDiagram
participant O as AsyncJobOrchestrator
participant P as Partition
participant J as Job
O->>O: Evaluate job status (FAILED vs TIMED_OUT)
alt Job status is FAILED
O->>P: Invoke _replace_failed_jobs
O->>P: Call _reallocate_partition to start a new job
else Job status is TIMED_OUT/COMPLETED
O->>P: Call _remove_completed_or_timed_out_jobs
O->>O: Free allocation and raise AirbyteTracedException
end
HTTP Job Repository Context FlowsequenceDiagram
participant Repo as AsyncHttpJobRepository
participant Job as AsyncJob
Job->>Repo: Request creation context
Repo->>Repo: Execute _get_creation_response_interpolation_context
Repo-->>Job: Return creation response data
Job->>Repo: Request polling context
Repo->>Repo: Execute _get_polling_response_interpolation_context
Repo-->>Job: Return polling response data
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
airbyte_cdk/sources/declarative/requesters/http_job_repository.py
Outdated
Show resolved
Hide resolved
pnilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for quickly updating this!
I have one comment regarding the use of .json() in the AsyncHttpJobRepository, other than that LGTM.
What
Original Slack thread:
Additional side-fix for the:
How
make the
TIMEOUTJob status to beTerminalmake the
TIMEOUTJob status non-retriableadd more interpolation context required by certain sources, like
source-amazon-ads, relying oncreation_response['headrs']['My-Header-Value']. Also valid for thepolling_responsecase.User Impact
No impact is expected, this is not a Breaking Change.
Summary by CodeRabbit
New Features
Tests