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

running profile without commit results in obscure AttributeError: 'Results' object has no attribute 'env' #801

Closed
yarikoptic opened this issue Apr 2, 2019 · 3 comments · Fixed by #1404
Labels
bug Triaged as a bug that needs fixing

Comments

@yarikoptic
Copy link
Contributor

$> asv profile  api.testds.time_create_test_dataset2x2      
Traceback (most recent call last):
  File "/home/yoh/proj/datalad/datalad/venvs/dev/bin/asv", line 11, in <module>
    load_entry_point('asv', 'console_scripts', 'asv')()
  File "/home/yoh/proj/misc/asv/asv/main.py", line 38, in main
    result = args.func(args)
  File "/home/yoh/proj/misc/asv/asv/commands/__init__.py", line 49, in run_from_args
    return cls.run_from_conf_args(conf, args)
  File "/home/yoh/proj/misc/asv/asv/commands/profiling.py", line 94, in run_from_conf_args
    **kwargs)
  File "/home/yoh/proj/misc/asv/asv/commands/profiling.py", line 148, in run
    for env in environments)
  File "/home/yoh/proj/misc/asv/asv/commands/profiling.py", line 148, in <genexpr>
    for env in environments)
AttributeError: 'Results' object has no attribute 'env'

and runs ok if I give HEAD

$> asv profile api.testds.time_create_test_dataset2x2 HEAD
· Discovering benchmarks
·· Uninstalling from virtualenv-py2.7.
·· Building ed8136f8 <bm-monkey-patch-is-interactive> for virtualenv-py2.7.
·· Installing ed8136f8 <bm-monkey-patch-is-interactive> into virtualenv-py2.7.
· Profile data does not already exist. Running profiler now.
·· Benchmarking virtualenv-py2.7
··· Running (api.testds.time_create_test_dataset2x2--).
··· api.testds.time_create_test_dataset2x2         
...
$> asv --version
asv 0.4.dev1608+7afea8e5
@pv pv added the bug Triaged as a bug that needs fixing label May 12, 2019
@jbrockmendel
Copy link
Contributor

I'm getting the same error, but specifying HEAD doesn't help

@HaoZeke
Copy link
Member

HaoZeke commented Mar 19, 2023

Can't reproduce this on master.

asv profile benchmarks.*.time_keys
· Discovering benchmarks
· Profile data does not already exist. Running profiler now.
·· Benchmarking virtualenv-py3.11
··· Running (benchmarks.TimeSuite.time_keys--).
··· benchmarks.TimeSuite.time_keys          3.83±0.04μs

Sun Mar 19 21:09:05 2023    /tmp/tmpo7g2mfj_

         5 function calls in 0.000 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.exec}
        1    0.000    0.000    0.000    0.000 /home/rgoswami/Git/Github/Python/asv/asv/benchmark.py:473(method_caller)
        1    0.000    0.000    0.000    0.000 /home/rgoswami/Git/Github/Python/blah/benchmarks/benchmarks.py:29(time_keys)
        1    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}

@brandonwillard
Copy link
Contributor

brandonwillard commented Jun 4, 2024

I'm seeing this issue with asv at 0.6.3 and asv_runner 0.2.1 (not sure if the latter is relevant here).

Looking at the asv.results.Results class I don't see where Results gets a .env field, nor do I see it referenced or used anywhere in asv aside from the asv.profiling.Profile.run (i.e. where the error occurs).

Changing result.env.name to result.env_name works until result.env.checkout_project is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Triaged as a bug that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants