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

Implement --timeout when running benchmarks #205

Merged
merged 6 commits into from
Sep 26, 2024
Merged

Conversation

diegorusso
Copy link
Contributor

If the benchmark execution is exceeding the timeout execution, pyperf exits with an error 124. This error can be caught by pyperformance or other tool and report it back to the user.

If the benchmark execution is exceeding the timeout execution, pyperf
exits with an error 124. This error can be caught by pyperformance or
other tool and report it back to the user.
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

I'm fine with the overall approach, but here is a review on the actual implementation.

pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_manager.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/_utils.py Outdated Show resolved Hide resolved
pyperf/tests/test_runner.py Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Nice, the change works as expected :-)

$ python -m pyperf timeit 'import time; time.sleep(5)' --timeout=2
Timed out after 2 seconds

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner merged commit 07d2a77 into psf:main Sep 26, 2024
13 checks passed
@vstinner
Copy link
Member

Merged, thanks.

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

Successfully merging this pull request may close these issues.

2 participants