GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Mark slow test methods with @requires_resource('cpu') · Issue #108416 · python/cpython

Mark slow test methods with @requires_resource('cpu') #108416

New issue
Copy link
New issue
Copy link
Closed
Closed
Mark slow test methods with @requires_resource('cpu')#108416
Copy link
Assignees
serhiy-storchaka
Labels
testsTests in the Lib/test dirTests in the Lib/test dir

Description

@serhiy-storchaka
serhiy-storchaka
opened on Aug 24, 2023
Issue body actions

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Proposal:

The proposed PR marks all test methods which have duration longer than 3 seconds with @test.support.requires_resource('cpu') decorator.

The purpose is to reduce manual testing time. It happens that all tests in a file are ran in fraction of a second, but few tests take a long time to run. When you work on some large feature or bugfix you need to run corresponding tests multiple times. You can exclude the slowest tests manually, but you should know what of them are culprits. When they are marked as CPU-hungry, you can just not enable the "cpu" resource.

For example, all test_math takes over 1.5 minutes to finish. But when exclude test_sumprod_stress, it takes only 3 seconds.

Linked PRs

  • gh-108416: Mark slow test methods with @requires_resource('cpu') #108421
  • gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') #108480
  • [3.12] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) #108798
  • [3.11] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) #108799
  • [3.12] gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) #108923
  • [3.11] gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) #108924

Activity

  1. serhiy-storchaka
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Aug 24, 2023
  2. serhiy-storchaka
    self-assigned this
    on Aug 24, 2023
  3. sobolevn commented on Aug 24, 2023

    @sobolevn
    sobolevn
    on Aug 24, 2023
    Member
    More actions

    Isn't it the same as #108388 ?

  4. serhiy-storchaka
    added a commit that references this issue on Aug 24, 2023

    pythongh-108416: Mark slow test methods with @requires_resource('cpu')

    3147ba9
  5. serhiy-storchaka commented on Aug 24, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 24, 2023
    MemberAuthor
    More actions

    No, they are different. The purpose is different, this issue is about speeding up manual testing, although it can help in CI testing too. I only mark the slowest methods, allowing fast tests to run. #108388 is much larger and more complex issue, this issue only intersects with a small part of it..

  6. gpshead commented on Aug 24, 2023

    @gpshead
    gpshead
    on Aug 24, 2023
    Member
    More actions

    This doesn't feel right. Tagging these as 'cpu' is usually untrue. Many of these tests are not resource intensive for anything but 'wall clock time'.

    Critically, it would means we have no easy reliable way of running this vast swath of our testsuite across multiple platforms when doing development if our Github CI does not use whatever resource is being applied so that the tests become skipped by default. If a dev has to do something special to identify and make tests potentially relevant change run across all platforms, they simply not going to get that determination right or remember a large portion of the time and the tests will not be run until after merge when it is too late. Allowing regressions to be merged is a net negative.

    Tangentially related: We should probably have all github actions CI configurations in release branches set to use -uall no matter what.

    Reacted by Erlend E. Aasland
  7. gpshead commented on Aug 24, 2023

    @gpshead
    gpshead
    on Aug 24, 2023 · Hidden as resolved
    show commentMore actions
  8. gpshead commented on Aug 25, 2023

    @gpshead
    gpshead
    on Aug 25, 2023
    Member
    More actions

    I think we want a new resource class for this purpose when latency is the main reason it is being disabled rather than actual CPU consumption. I suggest perhaps calling it 'walltime'?

    We could make a new -u category setting for github CI use called -ufast and configure specific github actions we want to respond faster to specify that. We could then control which other settings are turned on or off via that within regrtest itself. Leaving walltime enabled by default so that devs run those tests themselves by default. It'd be good to have at least one non-required GH actions CI check not using the "fast" run, or even doing a "-uall,-network,-largefile" run, as that still provides visibility on the PR.

    Even better if it is possible for the github merge queue automerge to wait for that not otherwise required CI check even though the merge button blocker does not? I don't know if github allows that level of config... @ambv ?

    (brainstorming)

    Reacted by Erlend E. Aasland
  9. serhiy-storchaka commented on Aug 25, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 25, 2023
    MemberAuthor
    More actions

    Re-did using time.process_time() instead of time.perf_counter(), and then using sum(os.times()[:4]), because some tests run CPU-heavy subprocesses. Now it includes about 46 tests.

    I prepared also a separate patch for marking long running tests which do not spend much CPU time, but simply sleep, with a new resource "walltime".

  10. serhiy-storchaka
    added a commit that references this issue on Aug 25, 2023

    pythongh-108416: Mark slow but not CPU bound test methods with requir…

    f144852
  11. serhiy-storchaka
    added a commit that references this issue on Sep 2, 2023

    gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-…

    f3ba0a7
  12. miss-islington
    added a commit that references this issue on Sep 2, 2023

    pythongh-108416: Mark slow test methods with @requires_resource('cpu') (

    ac6ae47
  13. serhiy-storchaka
    added a commit that references this issue on Sep 2, 2023

    [3.11] pythongh-108416: Mark slow test methods with @requires_resourc…

    4f394c2
  14. Yhg1s
    added a commit that references this issue on Sep 2, 2023

    [3.12] gh-108416: Mark slow test methods with @requires_resource('cpu…

    dcaacd9
  15. serhiy-storchaka
    added a commit that references this issue on Sep 3, 2023

    [3.11] gh-108416: Mark slow test methods with @requires_resource('cpu…

    76f5219
  16. serhiy-storchaka commented on Sep 3, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Sep 3, 2023
    MemberAuthor
    More actions

    See also #108828 which will help to find all tests which can be skipped for particular reason.

  17. serhiy-storchaka
    added a commit that references this issue on Sep 5, 2023

    gh-108416: Mark slow but not CPU bound test methods with requires_res…

    1e0d627
  18. miss-islington
    added a commit that references this issue on Sep 5, 2023

    pythongh-108416: Mark slow but not CPU bound test methods with requir…

    7cd8441
  19. serhiy-storchaka
    added 2 commits that reference this issue on Sep 5, 2023

    [3.11] pythongh-108416: Mark slow but not CPU bound test methods with…

    65b5218

    [3.11] gh-108416: Mark slow but not CPU bound test methods with requi…

    cf19e8e
  20. vstinner
    added a commit that references this issue on Sep 5, 2023

    pythongh-108416: Mark slow but not CPU bound test methods with requir…

    2cf86ef
  21. Yhg1s
    added a commit that references this issue on Sep 8, 2023

    [3.12] gh-108834: Sync libregrtest with the main branch (#108966)

    0855b2c
  22. serhiy-storchaka
    closed this as completedon Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

testsTests in the Lib/test dirTests in the Lib/test dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.