Skip to content

Commit

Permalink
do not show an error when nthreads is not changed
Browse files Browse the repository at this point in the history
  • Loading branch information
boennecd committed Jan 19, 2019
1 parent c2d961b commit 10d4f99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 5 additions & 4 deletions R/parglm.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ parglm.fit <- function(
if(nthreads_new < 1L)
nthreads_new <- 1L

warning(
"Too few observation compared to the number of threads. ",
nthreads_new, " thread(s) will be used instead of ",
control$nthreads, ".")
if(control$nthreads != nthreads_new)
warning(
"Too few observation compared to the number of threads. ",
nthreads_new, " thread(s) will be used instead of ",
control$nthreads, ".")

control$nthreads <- nthreads_new
}
Expand Down
5 changes: 3 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
solaris-x86-patched

## R CMD check results
There were no ERRORs, or WARNINGs. There is a NOTE on `fedora-gcc-devel` and
`debian-gcc-release` on rhub about the size of the package.
There were no ERRORs, or WARNINGs. There is a NOTE on `fedora-gcc-devel`
on rhub, my local machine, and `debian-gcc-release` on rhub about the size
of the package.
2 changes: 2 additions & 0 deletions tests/testthat/test_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ test_that("Using more threads then rows yields a warning", {
parglm( a ~ b - 1, data = this_df , nthreads = 64),
regexp = "Too few observation compared to the number of threads. 1 thread(s) will be used instead of 64.",
fixed = TRUE)

expect_silent(parglm( a ~ b - 1, data = this_df , nthreads = 1))
})

0 comments on commit 10d4f99

Please sign in to comment.