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

Check if parallel testing reduces check time in CI #2297

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

IndrajeetPatil
Copy link
Collaborator

Related to #2295

@codecov-commenter

This comment was marked as off-topic.

@IndrajeetPatil
Copy link
Collaborator Author

On main for macOS and R-release:

* checking tests ...
  Runningtestthat.R’ [67s/69s]
 [68s/69s] OK

In this PR for the same config:

* checking tests ...
  Runningtestthat.R’ [85s/46s]
 [85s/46s] OK

I don't understand why there are two timings, and which one we should care about.

The test-package workflows gives the exact duration, but that workflow fails here because options(warn = 2) seems to mess with the parallel testing.

@MichaelChirico
Copy link
Collaborator

Part of the issue is that I think there's a maximum number of jobs that can be running at once -- speeding up individual jobs helps some, but I'd really like to reduce the number of jobs if some jobs are redundant.

@IndrajeetPatil
Copy link
Collaborator Author

Agreed. But what do you think about turning on the parallel testing for {lintr}, in general?
Do you see any downsides to it, apart from the failing workflow, which is likely to be a {testthat} bug?

@MichaelChirico
Copy link
Collaborator

if we could have it run in serial by default and parallel according to environment variable on GHA only (not CRAN) I think that's preferable. parallelism is often a trojan horse for headaches if we don't get a huge benefit

@IndrajeetPatil
Copy link
Collaborator Author

Will setting something like this in testthat.R work (parallel on for non-CRAN, but off for CRAN)?

if (Sys.getenv("NOT_CRAN", "true") == "true") {
  Sys.setenv("TESTTHAT_PARALLEL" = "FALSE")
}

@IndrajeetPatil
Copy link
Collaborator Author

Filed an issue upstream about the error we see in the vigilant workflow: r-lib/testthat#1912

@AshesITR
Copy link
Collaborator

AshesITR commented Dec 1, 2023

On main for macOS and R-release:

* checking tests ...

  Runningtestthat.R’ [67s/69s]

 [68s/69s] OK

In this PR for the same config:

* checking tests ...

  Runningtestthat.R’ [85s/46s]

 [85s/46s] OK

I don't understand why there are two timings, and which one we should care about.

I suspect the first is CPU time and the second is elapsed (wall) time.
So we pay 6s more computational cost for 23s time savings. Seems worth it.

@IndrajeetPatil
Copy link
Collaborator Author

The reduction in test time from parallel testing has reduced significantly since the last time we checked; probably because our test suite itself has somehow got faster 👀

  • for main
* checking tests ...
  Runningtestthat.R’ [28s/29s]
 [29s/29s] OK
  • for PR
* checking tests ...
  Runningtestthat.R’ [49s/24s]
 [49s/24s] OK

I am no longer sure if it is still worth it to turn on parallel testing, or if we'd wait for our test suite to get even bigger before we could reap the benefits of parallel testing.

@IndrajeetPatil
Copy link
Collaborator Author

@MichaelChirico, @AshesITR WDYT?

Should we keep this PR open for a few more months or a year, rebase once in a while, and check for time saving benefits?
Or should we just kill it now and revisit only when we are faced with slow tests because of the growth in test suite?

@AshesITR
Copy link
Collaborator

I'm fine with either way. It looks like most of the work is done already and rebasing from time to time isn't difficult.

What do you think is best?

@IndrajeetPatil
Copy link
Collaborator Author

What do you think is best?

I think it should be fine (and costless) to keep this pending for a while.

@IndrajeetPatil IndrajeetPatil added the internals Issues related to inner workings of lintr, i.e., not user-visible label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Issues related to inner workings of lintr, i.e., not user-visible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants