-
Notifications
You must be signed in to change notification settings - Fork 67
feat: Retry exceptions in create() by adding PROTOCOL_ERROR_EXCEPTION_DICT #2581
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
base: main
Are you sure you want to change the base?
feat: Retry exceptions in create() by adding PROTOCOL_ERROR_EXCEPTION_DICT #2581
Conversation
WalkthroughThe default value of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ocp_resources/resource.py (1)
1007-1009: Update the docstring to reflect the optional parameter and default behavior.The method signature correctly makes
exceptions_dictoptional, but the docstring at line 1016 doesn't document that it's optional or what happens when it's not provided. Consider updating the docstring to clarify the default behavior.Apply this diff to improve the docstring:
Args: wait (bool) : True to wait for resource status. - exceptions_dict (dict[type[Exception], list[str]]): Dictionary of exceptions to retry on. + exceptions_dict (dict[type[Exception], list[str]] | None): Dictionary of exceptions to retry on. + If None (default), merges DEFAULT_CLUSTER_RETRY_EXCEPTIONS with PROTOCOL_ERROR_EXCEPTION_DICT.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ocp_resources/resource.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/resource.py (1)
ocp_resources/virtual_machine_import.py (1)
wait(192-230)
🔇 Additional comments (1)
ocp_resources/resource.py (1)
1021-1028: LGTM! Clean implementation of the default exceptions merge.The logic correctly merges the default cluster retry exceptions with protocol error exceptions when no custom exceptions_dict is provided. This achieves the PR objective of handling ProtocolError exceptions during resource creation without modifying global defaults. The approach is consistent with similar patterns used in the
wait()andwait_for_status()methods.
7019d73 to
da58386
Compare
|
/lgtm |
|
/approve |
|
/build-and-push-container |
|
No build-and-push-container configured for this repository |
|
/build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=da58386833be3aa53575ce23ea331580c29736b1 |
|
No build-and-push-container configured for this repository |
|
build image /build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=da58386833be3aa53575ce23ea331580c29736b1 |
|
@Ahmad-Hafe if you comment to build and push and you get an answer that it's not configured for this repository it's not going to work if you comment a few more times |
|
hi @myakove thanks for your comment |
|
@Ahmad-Hafe do not post internet links here |
|
/verified |
|
/cherry-pick v4.20 |
|
Cherry-pick requested for PR: |
da58386 to
7c8381f
Compare
|
/verified |
What is this? I search the internet for #3626 , I also ask the AI and not one know what is this. |
|
Hi @myakove , |
7c8381f to
d4b0b69
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ocp_resources/resource.py (1)
1007-1012: create() now correctly retries on protocol errors; optional thought on consistencyThe new default
exceptions_dict(union ofDEFAULT_CLUSTER_RETRY_EXCEPTIONSandPROTOCOL_ERROR_EXCEPTION_DICT) cleanly achieves the PR goal of makingcreate()resilient to protocol-level disconnects without mutating the global constants. Behavior of existing callers that pass their ownexceptions_dictremains unchanged.If, in future, you want protocol errors handled uniformly for other operations (e.g.,
instancelookups orget()classmethods), a small follow‑up could be to either:
- extend
retry_cluster_exceptions’s defaultexceptions_dictto also includePROTOCOL_ERROR_EXCEPTION_DICT, or- have those other call sites pass in a similarly extended dict.
Not required for this PR, just a possible consistency improvement later.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ocp_resources/resource.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/resource.py (1)
ocp_resources/virtual_machine_import.py (1)
wait(192-230)
|
/verified |
d4b0b69 to
d1bf216
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ocp_resources/resource.py (1)
1012-1015: Create retries now coverProtocolErrorcases – looks good; consider harmonizing dict-union order.The new default
exceptions_dictincludingPROTOCOL_ERROR_EXCEPTION_DICTmatches the PR goal and alignscreate()with how other operations use protocol-related retries. No functional issues spotted.Minor consistency nit: other methods use a different merge order (
PROTOCOL_ERROR_EXCEPTION_DICT | DEFAULT_CLUSTER_RETRY_EXCEPTIONSinwait_for_status, and**PROTOCOL_ERROR_EXCEPTION_DICT,**…,**DEFAULT_CLUSTER_RETRY_EXCEPTIONSinwait, where the last wins on key clashes). Here,DEFAULT_CLUSTER_RETRY_EXCEPTIONS | PROTOCOL_ERROR_EXCEPTION_DICTwould make protocol-specific entries override any overlapping default entries, whereas inwait_for_statusthe defaults would win.If you want uniform behavior and simpler reasoning later, consider aligning the merge order with
wait_for_status, e.g.:- exceptions_dict: dict[type[Exception], list[str]] = DEFAULT_CLUSTER_RETRY_EXCEPTIONS - | PROTOCOL_ERROR_EXCEPTION_DICT, + exceptions_dict: dict[type[Exception], list[str]] = PROTOCOL_ERROR_EXCEPTION_DICT + | DEFAULT_CLUSTER_RETRY_EXCEPTIONS,
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ocp_resources/resource.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/resource.py (1)
ocp_resources/virtual_machine_import.py (1)
wait(192-230)
Short description:
Update the create() method to handle ProtocolError exceptions during resource creation by including PROTOCOL_ERROR_EXCEPTION_DICT in the default exceptions_dict. This ensures retries for connection aborts and remote disconnects without changing the global defaults.
More details:
failed on setup with "urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))"
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.