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

FIX: Fixed some issues around vb_suite #9332

Merged
merged 2 commits into from
Jan 22, 2015
Merged
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
3 changes: 3 additions & 0 deletions vb_suite/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,6 @@ def inject_bmark_into_globals(bmark):
for func_name in no_arg_func_list:
bmark = make_large_ngroups_bmark(ngroups, func_name)
inject_bmark_into_globals(bmark)

# avoid bmark to be collected as Benchmark object
del bmark
Copy link
Author

Choose a reason for hiding this comment

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

without this fix, I got following error:

$ rm vb_suite/benchmarks.db
$ ./test_perf.sh -b master -t HEAD -r groupby
...
2015-01-22 20:47:50,103 [INFO  ] Writing new benchmark groupby_ngroups_100_value_counts, b88a3ca315564ed6afdd935e4d2dc8ad (runner.py:153)
2015-01-22 20:47:50,105 [INFO  ] Writing new benchmark groupby_ngroups_10000_value_counts, f7a6e1f815904619a0428842d3fa2ffe (runner.py:153)
2015-01-22 20:47:50,107 [INFO  ] Writing new benchmark groupby_ngroups_10000_sum, 973f817c1bd057ddc5476e5af7667ed6 (runner.py:153)
2015-01-22 20:47:50,118 [INFO  ] Writing new benchmark groupby_ngroups_10000_value_counts, f7a6e1f815904619a0428842d3fa2ffe (runner.py:153)
...
sqlalchemy.exc.IntegrityError: (IntegrityError) UNIQUE constraint failed: benchmarks.checksum u'INSERT INTO benchmarks (checksum, name, description) VALUES (?, ?, ?)' ('f7a6e1f815904619a0428842d3fa2ffe', 'groupby_ngroups_10000_value_counts', None)

This is because suite module collects all Benchmark objects in groupby module, while temporary variable bmark presents outside the for loop.

9 changes: 4 additions & 5 deletions vb_suite/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
dt = ts.index[500]
"""
statement = "ts[dt]"

bm_getitem = Benchmark(statement, setup, ncalls=100000,
name='series_getitem_scalar')
name='time_series_getitem_scalar')
Copy link
Author

Choose a reason for hiding this comment

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

This was same Benchmark name as L220 one. This doesn't cause error, but confusing.


setup = common_setup + """
index = tm.makeStringIndex(1000)
s = Series(np.random.rand(1000), index=index)
idx = index[100]
"""
statement = "s.get_value(idx)"
bm_df_getitem3 = Benchmark(statement, setup,
name='series_get_value',
start_date=datetime(2011, 11, 12))
bm_get_value = Benchmark(statement, setup,
name='series_get_value',
start_date=datetime(2011, 11, 12))


setup = common_setup + """
Expand Down
4 changes: 2 additions & 2 deletions vb_suite/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from pandas import DataFrame, Series

from suite import REPO_PATH
VB_DIR = os.path.dirname(os.path.abspath(__file__))
VB_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Copy link
Author

Choose a reason for hiding this comment

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

without this, I got following error:

$ ./test_perf.sh -b master -t HEAD -r series
Verifying specified commits exist in repo...
Traceback (most recent call last):
  File "/Users/junya/work/github/pandas/vb_suite/test_perf.py", line 606, in <module>
    r=git.Repo(VB_DIR)
  File "/usr/local/opt/pyenv/versions/pandas27/lib/python2.7/site-packages/git/repo/base.py", line 149, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /Users/junya/work/github/pandas/vb_suite

VB_DIR is pointing vb_suite directory now.

DEFAULT_MIN_DURATION = 0.01
HEAD_COL="head[ms]"
BASE_COL="base[ms]"
Expand Down Expand Up @@ -505,7 +505,7 @@ def main():

print("\n")

# move away from the pandas root dit, to avoid possible import
# move away from the pandas root dir, to avoid possible import
# surprises
os.chdir(os.path.dirname(os.path.abspath(__file__)))

Expand Down