Skip to content

Commit

Permalink
Merge 20986ad into 9a6860c
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed Aug 3, 2021
2 parents 9a6860c + 20986ad commit ff0ad00
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
4 changes: 4 additions & 0 deletions conbench/entities/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def get_github_commit(repository, sha):
github = GitHub()
name = repository.split("github.com/")[1]
commit = github.get_commit(name, sha)
if commit is None:
return {}

parent = commit["parent"]
commits = github.get_commits(name, parent)
if parent in commits:
Expand All @@ -87,6 +90,7 @@ def get_github_commit(repository, sha):
return commit
else:
parent = other["parent"]

return {}


Expand Down
38 changes: 26 additions & 12 deletions conbench/entities/summary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
import decimal

import flask as f
Expand Down Expand Up @@ -89,18 +90,31 @@ def create(data):
commit = Commit.first(sha=sha)
if not commit:
github = get_github_commit(repository, sha)
commit = Commit.create(
{
"sha": sha,
"repository": repository,
"parent": github["parent"],
"timestamp": github["date"],
"message": github["message"],
"author_name": github["author_name"],
"author_login": github["author_login"],
"author_avatar": github["author_avatar"],
}
)
if github:
commit = Commit.create(
{
"sha": sha,
"repository": repository,
"parent": github["parent"],
"timestamp": github["date"],
"message": github["message"],
"author_name": github["author_name"],
"author_login": github["author_login"],
"author_avatar": github["author_avatar"],
}
)
else:
now = datetime.datetime.now(datetime.timezone.utc)
commit = Commit.create(
{
"sha": sha,
"repository": repository,
"parent": "unknown",
"timestamp": now,
"message": "unknown",
"author_name": "unknown",
}
)

# create if not exists
run_id = data["run_id"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="conbench",
version="1.1.0",
version="1.2.0",
description="Continuous Benchmarking (CB) Framework",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit ff0ad00

Please sign in to comment.