Skip to content

Commit

Permalink
Acknowledge network issues from GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed Jan 15, 2025
1 parent aa67b82 commit ae39a68
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
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

0 comments on commit ae39a68

Please sign in to comment.