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

Failing package test on single-core machines #513

Closed
HenrikBengtsson opened this issue Apr 10, 2022 · 5 comments · Fixed by #538
Closed

Failing package test on single-core machines #513

HenrikBengtsson opened this issue Apr 10, 2022 · 5 comments · Fixed by #538
Labels
Milestone

Comments

@HenrikBengtsson
Copy link

Hi, I'm running conservative revdep checks on parallelly and future, where I check if they work on single-core machines, which might be the case on cloud CI services, free RStudio Cloud accounts, etc. I use export R_PARALLELLY_AVAILABLE_CORES=1 to emulate this. Doing this, I spotted greta failing with:

* checking tests ...

  Running ‘spelling.R’
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 50 lines of output:
  x Initialising python and checking dependencies, this may take a moment. ... ...
  
  i Initialising python and checking dependencies, this may take a moment.
  x Initialising python and checking dependencies, this may take a moment. ... ...
  
...
   4. │     ├─testthat .capture(...)
   5. │     │ └─base::withCallingHandlers(...)
   6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   7. └─greta:::check_future_plan()
  
  [ FAIL 1 | WARN 0 | SKIP 251 | PASS 4 ]
  Deleting unused snapshots:
  • greta-sitrep.md
  Error: Test failures
  Execution halted

Source: https://github.com/HenrikBengtsson/parallelly/blob/71e60044d1b6daf83f66f424ff380a004147155b/revdep/R_PARALLELLY_AVAILABLECORES_SYSTEM%3D1/problems.md#greta

I haven't tracked this down further, but it could be an assumption that plan(multisession) will produce multisession futures, but if availableCores() == 1, then they'll become sequential futures.

@njtierney
Copy link
Collaborator

Thanks for this, @HenrikBengtsson ! I'm not really sure how to track this test down, do you know which test in particular fails?

@HenrikBengtsson
Copy link
Author

HenrikBengtsson commented Apr 13, 2022

Sorry, I don't see more then the above either*.

You should be able to reproduce it by setting environment variable:

R_PARALLELLY_AVAILABLE_CORES=1

before loading parallelly the first time, i.e. before running the tests.

(*) This is actually the main reason why I still don't use modern unit test frameworks like testthat, RUnit, tidytest myself. With them, R CMD check will only report on one giant test. With individual tests/*.R test scripts, you see exactly which test scripts passed and which failed. But there's hope; markvanderloo/tinytest#78

@njtierney
Copy link
Collaborator

I've tried to create a GH action to add this environment variable to R CMD check, this felt like a somewhat decent way to check that across multiple systems? Specifically, added this code to the R-CMD-check.yml

      - name: Check on single core machine
        if: runner.os != 'Windows'
        env:
          R_PARALLELLY_AVAILABLE_CORES: 1
        run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-multiarch"))
        shell: Rscript {0}

@HenrikBengtsson
Copy link
Author

That looks correct to me.

@njtierney
Copy link
Collaborator

OK awesome - I think I'm going to close this issue with PR #538 then, as all tests are passing now :)

@njtierney njtierney modified the milestones: 0.5.0, 0.4.3 Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants