Skip to content

Commit

Permalink
updating github manager to use tags, and then look for version strings (
Browse files Browse the repository at this point in the history
#36)

* updating github manager to use tags, and then look for version
strings. The reason is because if we use the releases api, it
does not include non verified releases
* pyflakes
* updating changed lines result

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Co-authored-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch and vsoch committed Mar 11, 2021
1 parent c1fd0dc commit c9afc90
Show file tree
Hide file tree
Showing 5 changed files with 5,199 additions and 5,168 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip.

## [0.2.x](https://github.com/vsoch/caliper/tree/master) (0.0.x)
- update caliper view for new organization of data (0.0.23)
- adding Dataverse manager (0.0.22)
- try catching error on cleanup (0.0.2)(0.0.21)
- fixing bug with cleanup - should only remove if directory exists (0.0.19)
Expand Down
14 changes: 12 additions & 2 deletions caliper/managers/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
__copyright__ = "Copyright 2020-2021, Vanessa Sochat"
__license__ = "MPL 2.0"

from distutils.version import StrictVersion
from caliper.utils.command import do_request
from caliper.logger import logger
from caliper.managers.base import ManagerBase
Expand Down Expand Up @@ -32,16 +33,25 @@ def get_package_metadata(self, name=None):
raise ValueError("A package name is required.")

# At some point we might need to add pagination
url = "%s/repos/%s/releases?per_page=100" % (self.baseurl, name)
# url = "%s/repos/%s/releases?per_page=100" % (self.baseurl, name)

# Currently we are using tags, as non verified releases are not included
url = "%s/repos/%s/tags?per_page=100" % (self.baseurl, name)
self.metadata = do_request(url, headers=self._get_headers())

# Parse metadata into simplified version of spack package schema
for release in self.metadata:

# Only include valid versions
try:
StrictVersion(release["name"].lstrip("v"))
except:
continue

self._specs.append(
{
"name": name,
"version": release["tag_name"],
"version": release["name"],
"source": {
"filename": release["tarball_url"],
"type": "targz",
Expand Down
14 changes: 9 additions & 5 deletions caliper/metrics/collection/changedlines/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ def get_plot_data(self, result_file, title=None):
logger.exit("Data file %s is empty." % filename)

# We currently support just the group plot
if "by-group" not in self._data:
logger.exit("by-group key is missing from data.")
self._data = self._data["by-group"]
data = {}
for key, group in self._data.items():
if "by-group" in group:
data[key] = group["by-group"]

if not data:
logger.exit("data are missing by-group entries.")

# Prepare datasets, each of a different color, and title
labels = self._derive_labels()
insertion_dataset = [self._data[label]["insertions"] for label in labels]
deletion_dataset = [self._data[label]["deletions"] for label in labels]
insertion_dataset = [data[label]["insertions"] for label in labels]
deletion_dataset = [data[label]["deletions"] for label in labels]
datasets = [
{"data": insertion_dataset, "title": "Insertions", "color": "turquoise"},
{"data": deletion_dataset, "title": "Deletions", "color": "tomato"},
Expand Down
2 changes: 1 addition & 1 deletion caliper/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__copyright__ = "Copyright 2020-2021, Vanessa Sochat"
__license__ = "MPL 2.0"

__version__ = "0.0.22"
__version__ = "0.0.23"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "vsochat@stanford.edu"
NAME = "caliper"
Expand Down

0 comments on commit c9afc90

Please sign in to comment.