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

app/benchmark-results: page returns 500 when commit is missing timestamp #1522

Open
DeaMariaLeon opened this issue Oct 29, 2023 · 8 comments

Comments

@DeaMariaLeon
Copy link
Contributor

My local conbench server lists the benchmark name on the CI run area.
But when I navigate to http://127.0.0.1:5000/c-benchmarks/ the benchmarks by name list is empty. Am I missing something or is this a bug?

Here is the CI run:
Screenshot 2023-10-29 at 20 03 34

Nothing shown here:

Screenshot 2023-10-29 at 20 04 16

Also, on the CI run area (first picture), clicking on the link 0653ea1b8 in the column "result",there is an exception. I'm not sure if I should report this on another issue or not. Here it is:

unexpected exception, please report this:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/views.py", line 188, in dispatch_request
    return current_app.ensure_sync(meth)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/conbench/app/_endpoint.py", line 28, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/conbench/app/results.py", line 269, in get
    return self.page(
           ^^^^^^^^^^
  File "/app/conbench/app/results.py", line 240, in page
    return self.render_template(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/app/conbench/app/_endpoint.py", line 135, in render_template
    return f.render_template(template, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
    return _render(app, template, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 130, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/app/conbench/templates/benchmark-result.html", line 2, in top-level template code
    {% import 'bootstrap/wtf.html' as wtf %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/conbench/templates/app.html", line 2, in top-level template code
    {% block doc -%}
  File "/app/conbench/templates/app.html", line 5, in block 'doc'
    {%- block html %}
  File "/app/conbench/templates/app.html", line 40, in block 'html'
    {% block body -%}
  File "/app/conbench/templates/app.html", line 106, in block 'body'
    {% block content %}
  File "/app/conbench/templates/app.html", line 122, in block 'content'
    {% block app_content %}{% endblock %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/conbench/templates/benchmark-result.html", line 42, in block 'app_content'
    ({{ result.commit.timestamp.strftime("%Y-%m-%d") }})
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/utils.py", line 83, in from_obj
    if hasattr(obj, "jinja_pass_arg"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'strftime'

Could someone help?
I'm trying to write an adapter for asv (Airspeed velocity benchmarks library), part of a PoC for pandas. Thanks in advance.

@austin3dickey
Copy link
Member

({{ result.commit.timestamp.strftime("%Y-%m-%d") }})
jinja2.exceptions.UndefinedError: 'None' has no attribute 'strftime'

Ah interesting; it looks like fetching "additional commit metadata" from the GitHub API failed, possibly because that commit doesn't exist on GitHub. So your server stored the repository name and commit hash but no commit timestamp.

This should be a supported workflow, but it looks like the current template can't handle it. Maybe that line needs another | safe to protect against this case.


For the c-benchmarks issue, that page is populated by a cache of the most recent N benchmark results. It's possible that cache can become a bit stale. I believe the job to populate that cache runs every 2 minutes by default. I wonder if waiting a few minutes would allow that page to be populated?

@DeaMariaLeon
Copy link
Contributor Author

Thanks a lot for your reply.

possibly because that commit doesn't exist on GitHub.

Yes it does exist on GitHub, clicking on the commit link nicely opens it on GitHub.


I wonder if waiting a few minutes would allow that page to be populated?

The first time I run the client was on Oct 29, so I have been waiting for 3 days. :-)
Screenshot 2023-10-31 at 08 20 49

@DeaMariaLeon
Copy link
Contributor Author

This should be a supported workflow, but it looks like the current template can't handle it. Maybe that line needs another | safe to protect against this case.

I added | safe to the code as you suggested but didn't protect against the case when a commit that doesn't exist. But my commit (that does exist) works correctly by using the latest development version of conbench. My other issue (about the c-benchmarks) is also fixed using the dev. version.

So, if the commit does not exist, it still breaks (even when using the dev version). Adding | safe doesn't protect against it, for what I saw. Unless I'm missing something of course.

@austin3dickey austin3dickey changed the title benchmark name not listed on http://127.0.0.1:5000/c-benchmarks/ app/benchmark-results: page doesn't display when commit is missing timestamp Oct 31, 2023
@austin3dickey austin3dickey changed the title app/benchmark-results: page doesn't display when commit is missing timestamp app/benchmark-results: page returns 500 when commit is missing timestamp Oct 31, 2023
@austin3dickey
Copy link
Member

I think this is related to #904; since the commit is missing metadata but exists in GitHub it would be nice if we tried again to fetch that data.

But it's definitely a bug that the page doesn't display correctly in this case.

@austin3dickey
Copy link
Member

I was able to reproduce this bug by adding this test: 6495d76

The last line fails with a 500 and the same traceback that you posted above. If you'd like to take a shot at fixing this, please feel free! Else I can get to it in the next couple of days.

@DeaMariaLeon
Copy link
Contributor Author

I would love to (at least) try to fix it. Thanks.

@DeaMariaLeon
Copy link
Contributor Author

DeaMariaLeon commented Nov 9, 2023

@austin3dickey I'm sorry I have not started on this. The adapter I'm working on is taking all my time.
If you need to fix this now, please go ahead. Maybe I can find another bug to work on later.
If you do not need it fix very fast, I can still try.

@austin3dickey
Copy link
Member

No rush on my end! Take your time; I still need to make sure forks of this repo can run the CI anyway. (#1525)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants