Skip to content
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

Acknowledge network issues from GitHub #710

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions miss_islington/delete_branch.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import asyncio

import gidgethub
import gidgethub.routing
import stamina

router = gidgethub.routing.Router()


@router.register("pull_request", action="closed")
@stamina.retry(on=gidgethub.GitHubException, timeout=120)
async def delete_branch(event, gh, *args, **kwargs):
"""
Delete the branch once miss-islington's PR is closed.
Expand Down
25 changes: 21 additions & 4 deletions miss_islington/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
cache = cachetools.LRUCache(maxsize=500)
sentry_sdk.init(os.environ.get("SENTRY_DSN"), integrations=[CeleryIntegration()])


CHERRY_PICKER_CONFIG = {
"team": "python",
"repo": "cpython",
Expand Down Expand Up @@ -125,7 +124,7 @@ async def backport_task_asyncio(
)
try:
cp.backport()
except cherry_picker.BranchCheckoutException:
except cherry_picker.BranchCheckoutException as bce:
await util.comment_on_pr(
gh,
issue_number,
Expand All @@ -139,6 +138,8 @@ async def backport_task_asyncio(
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
bce_state = cp.get_state_and_verify()
print(bce_state, bce)
cp.abort_cherry_pick()
except cherry_picker.CherryPickException as cpe:
await util.comment_on_pr(
Expand All @@ -153,9 +154,25 @@ async def backport_task_asyncio(
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
cpe_exc = cpe
cpe_state = cp.get_state_and_verify()
print(cpe_state)
print(cpe_state, cpe)
cp.abort_cherry_pick()
except cherry_picker.GitHubException as ghe:
await util.comment_on_pr(
gh,
issue_number,
f"""\
Sorry {util.get_participants(created_by, merged_by)}, I had trouble completing the backport.
Please retry by removing and re-adding the "needs backport to {branch}" label.
Please backport backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on the command line.
```
cherry_picker {commit_hash} {branch}
```
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
ghe_state = cp.get_state_and_verify()
print(ghe_state, ghe)
cp.abort_cherry_pick()


Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
cherry_picker==2.4.0
#git+https://github.com/python/cherry-picker.git@remove-initial-state#egg=cherry_picker
#cherry_picker==2.4.0
git+https://github.com/python/cherry-picker.git@network-issues#egg=cherry_picker
aiohttp==3.11.11
gidgethub==5.3.0
cachetools==5.5.0
redis==5.2.1
celery==5.4.0
sentry-sdk==2.19.2
stamina==24.3.0
click==8.1.8
Loading