Skip to content

Commit ae39a68

Browse files
committed
Acknowledge network issues from GitHub
1 parent aa67b82 commit ae39a68

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

miss_islington/delete_branch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import asyncio
22

3+
import gidgethub
34
import gidgethub.routing
5+
import stamina
46

57
router = gidgethub.routing.Router()
68

79

810
@router.register("pull_request", action="closed")
11+
@stamina.retry(on=gidgethub.GitHubException, timeout=120)
912
async def delete_branch(event, gh, *args, **kwargs):
1013
"""
1114
Delete the branch once miss-islington's PR is closed.

miss_islington/tasks.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
cache = cachetools.LRUCache(maxsize=500)
3030
sentry_sdk.init(os.environ.get("SENTRY_DSN"), integrations=[CeleryIntegration()])
3131

32-
3332
CHERRY_PICKER_CONFIG = {
3433
"team": "python",
3534
"repo": "cpython",
@@ -125,7 +124,7 @@ async def backport_task_asyncio(
125124
)
126125
try:
127126
cp.backport()
128-
except cherry_picker.BranchCheckoutException:
127+
except cherry_picker.BranchCheckoutException as bce:
129128
await util.comment_on_pr(
130129
gh,
131130
issue_number,
@@ -139,6 +138,8 @@ async def backport_task_asyncio(
139138
""",
140139
)
141140
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
141+
bce_state = cp.get_state_and_verify()
142+
print(bce_state, bce)
142143
cp.abort_cherry_pick()
143144
except cherry_picker.CherryPickException as cpe:
144145
await util.comment_on_pr(
@@ -153,9 +154,25 @@ async def backport_task_asyncio(
153154
""",
154155
)
155156
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
156-
cpe_exc = cpe
157157
cpe_state = cp.get_state_and_verify()
158-
print(cpe_state)
158+
print(cpe_state, cpe)
159+
cp.abort_cherry_pick()
160+
except cherry_picker.GitHubException as ghe:
161+
await util.comment_on_pr(
162+
gh,
163+
issue_number,
164+
f"""\
165+
Sorry {util.get_participants(created_by, merged_by)}, I had trouble completing the backport.
166+
Please retry by removing and re-adding the "needs backport to {branch}" label.
167+
Please backport backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on the command line.
168+
```
169+
cherry_picker {commit_hash} {branch}
170+
```
171+
""",
172+
)
173+
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
174+
ghe_state = cp.get_state_and_verify()
175+
print(ghe_state, ghe)
159176
cp.abort_cherry_pick()
160177

161178

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
cherry_picker==2.4.0
2-
#git+https://github.com/python/cherry-picker.git@remove-initial-state#egg=cherry_picker
1+
#cherry_picker==2.4.0
2+
git+https://github.com/python/cherry-picker.git@network-issues#egg=cherry_picker
33
aiohttp==3.11.11
44
gidgethub==5.3.0
55
cachetools==5.5.0
66
redis==5.2.1
77
celery==5.4.0
88
sentry-sdk==2.19.2
9+
stamina==24.3.0
910
click==8.1.8

0 commit comments

Comments
 (0)