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

Pr metrics improvements #102

Open
wants to merge 8 commits into
base: dev/mpg/pr-metrics
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 12 additions & 2 deletions pr-metrics/get-pr-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

"""Get PR data from github and pickle it."""
daverodgman marked this conversation as resolved.
Show resolved Hide resolved

import pickle
import os
import requests.exceptions
import time

from github import Github

Expand Down Expand Up @@ -38,4 +39,13 @@
p.update()

with open("pr-data.p", "wb") as f:
pickle.dump(prs, f)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this comment here as it does not let me put it in unchanged lines of code:
Nit: Maybe we can change r = g.get_repo("ARMMbed/mbedtls") from line 18 to r = g.get_repo("Mbed-TLS/mbedtls") ?

for i, p in enumerate(prs):
for retry in range(0, 9):
try:
g.dump(p, f)
break
except requests.exceptions.ReadTimeout:
delay = 2 ** retry
print(f"timeout; sleeping {delay} s and retrying...")
time.sleep(2 ** delay)
print(f"saved {i+1}/{len(prs)}")
tgonzalezorlandoarm marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 8 additions & 3 deletions pr-metrics/prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@

"""PR data an misc common functions."""

import pickle
import datetime
import os
from github import Github

prs = []
with open("pr-data.p", "rb") as f:
prs = pickle.load(f)

g = Github()
try:
while True:
prs.append(g.load(f))
tgonzalezorlandoarm marked this conversation as resolved.
Show resolved Hide resolved
except EOFError:
pass

# Current and past core contributors, alphabetical order (sort -f).
#
Expand Down