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

Fix tests. Fix linting issues. Added release action. #46

Merged
merged 4 commits into from
Jan 14, 2024
Merged

Conversation

sciome-bot
Copy link
Collaborator

No description provided.

shail-choksi and others added 3 commits January 13, 2024 12:14
Merge in STAT/prestogp from master to to-git

Squashed commit of the following:

commit db6cd4f6f86e760ee8393adf224cd0231ccde8cf
Merge: 55607e2 7da2588
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sat Jan 13 12:11:56 2024 -0500

    Pull request #29: Fixed some bugs caused by the linter

    Merge in STAT/prestogp from eb-dev to master

    * commit '7da2588abba4491c1ff490de95e834d00f5df88e':
      Fixed some bugs caused by the linter

commit 7da2588abba4491c1ff490de95e834d00f5df88e
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sat Jan 13 01:37:58 2024 -0500

    Fixed some bugs caused by the linter

commit 55607e291477d174b8323bf258a8e9aa5c4db84c
Merge: c7ed481 81b675d
Author: Shail Choksi <shail.choksi@sciome.com>
Date:   Fri Jan 12 19:37:55 2024 -0500

    Pull request #28: Final linting fixes

    Merge in STAT/prestogp from build-workflow to master

    * commit '81b675dda9b57f2a362c34876364adf5bcf45560':
      Fix remaining linting issues
      Fix all indentation errors
      Add indentation_linter configuration to lintr config file

commit 81b675d
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 19:36:05 2024 -0500

    Fix remaining linting issues

commit 06673a4
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 19:23:11 2024 -0500

    Fix all indentation errors

commit c7ed481479c2ca5a4fc111f429affd01b6c3ce53
Merge: 723c3eb 7bcfa1a
Author: Shail Choksi <shail.choksi@sciome.com>
Date:   Fri Jan 12 19:02:59 2024 -0500

    Pull request #27: Lintr fixes. Added release and sanitizer actions

    Merge in STAT/prestogp from build-workflow to master

    * commit '7bcfa1aca78cc6b994cc0227c083357c58d50ca0': (21 commits)
      Add R_LINTR_LINTER_FILE to lint action to point to global .lintr file
      More lintr fixes for 1:length, 1:nrow and line length. Disabled object_length_linter
      WIP: Fix linter warnings for 1:nrow, 1:ncol and 1:length. Increase line length to 160 chars
      Don't build vignettes during the release action
      Move release action file to correct directory
      Add release action
      Reorder imports in RcppExports file
      Add missing dependency in Namespace/Description
      Remove unneeded exports from NAMESPACE
      Add missing comma in Imports section of DESCRIPTION
      Add missing comma in imports section of DESCRIPTION
      Rerun auto-formatter
      WIP - linting
      Add ignore rules for .lintr and .github for R build
      remove linter options from lint action as we have added .lintr project file. Fix all vector_logic_linter warnings
      Remove line length linter to see the remaining errors/warnings
      workaround for lintr bug: REditorSupport/languageserver#89
      Run auto-lint on vscode
      enable linting on build-workflow
      Add missing imports in DESCRIPTION
      ...

commit 29d82cd
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 18:40:17 2024 -0500

    Add indentation_linter configuration to lintr config file

commit 7bcfa1a
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 18:16:01 2024 -0500

    Add R_LINTR_LINTER_FILE to lint action to point to global .lintr file

commit b6df473
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 17:54:50 2024 -0500

    More lintr fixes for 1:length, 1:nrow and line length. Disabled object_length_linter

commit 6f6f91d
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 17:32:12 2024 -0500

    WIP: Fix linter warnings for 1:nrow, 1:ncol and 1:length. Increase line length to 160 chars

commit 2db2e19
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:48:59 2024 -0500

    Don't build vignettes during the release action

commit c539223
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:39:52 2024 -0500

    Move release action file to correct directory

commit f83df2b
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:36:03 2024 -0500

    Add release action

commit c84e159
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:04:36 2024 -0500

    Reorder imports in RcppExports file

commit 0460202
Merge: 245eaa3 43ae272
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 15:48:30 2024 -0500

    Merge branch 'build-workflow' of sciome-bot-git:Spatiotemporal-Exposures-and-Toxicology/PrestoGP into build-workflow

commit 245eaa3
Merge: 5355e24 c060815
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 15:47:42 2024 -0500

    Merge branch 'main' of sciome-bot-git:Spatiotemporal-Exposures-and-Toxicology/PrestoGP into build-workflow

commit c060815
Merge: 731da76 6d69b69
Author: {SET}group <127860447+Spatiotemporal-Exposures-and-Toxicology@users.noreply.github.com>
Date:   Thu Jan 11 16:02:52 2024 -0500

    Merge pull request #44 from Spatiotemporal-Exposures-and-Toxicology/main-sciome

    Sciome Update 1/10/2024

commit 6d69b69
Author: sciome-bot <software.tools@sciome.com>
Date:   Thu Jan 11 14:39:39 2024 -0500

    Add missing dependency in Namespace/Description

commit bdf52c6
Author: sciome-bot <software.tools@sciome.com>
Date:   Thu Jan 11 14:30:38 2024 -0500

    Remove unneeded exports from NAMESPACE

commit 06918b0
Author: sciome-bot <software.tools@sciome.com>
Date:   Thu Jan 11 14:15:45 2024 -0500

    Add missing comma in Imports section of DESCRIPTION

... and 13 more commits
@kyle-messier
Copy link
Collaborator

@sciome-bot @shail-choksi @ericbair-sciome Do y'all want to merge this pull request into main now or wait until other checks pass?

Merge in STAT/prestogp from master to to-git

Squashed commit of the following:

commit 439790cb0d96d85e80a3782ad533eee78afe41dc
Merge: f4af0d1 56f881f
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sun Jan 14 10:58:49 2024 -0500

    Pull request #32: Fixed some testthat issues

    Merge in STAT/prestogp from eb-dev to master

    * commit '56f881f96a0e55e60bca3c8a840ec31291665594':
      Fixed some testthat issues

commit 56f881f96a0e55e60bca3c8a840ec31291665594
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sat Jan 13 14:05:12 2024 -0500

    Fixed some testthat issues

commit f4af0d1be3490dd2edd4f4fd0ae97bf729464748
Merge: db6cd4f ee193de
Author: sciome-bot <software.tools@sciome.com>
Date:   Sat Jan 13 12:37:28 2024 -0500

    Merge branch 'main-sciome' of sciome-bot-git:Spatiotemporal-Exposures-and-Toxicology/PrestoGP

commit db6cd4f6f86e760ee8393adf224cd0231ccde8cf
Merge: 55607e2 7da2588
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sat Jan 13 12:11:56 2024 -0500

    Pull request #29: Fixed some bugs caused by the linter

    Merge in STAT/prestogp from eb-dev to master

    * commit '7da2588abba4491c1ff490de95e834d00f5df88e':
      Fixed some bugs caused by the linter

commit 7da2588abba4491c1ff490de95e834d00f5df88e
Author: Eric Bair <eric.bair@sciome.com>
Date:   Sat Jan 13 01:37:58 2024 -0500

    Fixed some bugs caused by the linter

commit 55607e291477d174b8323bf258a8e9aa5c4db84c
Merge: c7ed481 81b675d
Author: Shail Choksi <shail.choksi@sciome.com>
Date:   Fri Jan 12 19:37:55 2024 -0500

    Pull request #28: Final linting fixes

    Merge in STAT/prestogp from build-workflow to master

    * commit '81b675dda9b57f2a362c34876364adf5bcf45560':
      Fix remaining linting issues
      Fix all indentation errors
      Add indentation_linter configuration to lintr config file

commit 81b675d
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 19:36:05 2024 -0500

    Fix remaining linting issues

commit 06673a4
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 19:23:11 2024 -0500

    Fix all indentation errors

commit c7ed481479c2ca5a4fc111f429affd01b6c3ce53
Merge: 723c3eb 7bcfa1a
Author: Shail Choksi <shail.choksi@sciome.com>
Date:   Fri Jan 12 19:02:59 2024 -0500

    Pull request #27: Lintr fixes. Added release and sanitizer actions

    Merge in STAT/prestogp from build-workflow to master

    * commit '7bcfa1aca78cc6b994cc0227c083357c58d50ca0': (21 commits)
      Add R_LINTR_LINTER_FILE to lint action to point to global .lintr file
      More lintr fixes for 1:length, 1:nrow and line length. Disabled object_length_linter
      WIP: Fix linter warnings for 1:nrow, 1:ncol and 1:length. Increase line length to 160 chars
      Don't build vignettes during the release action
      Move release action file to correct directory
      Add release action
      Reorder imports in RcppExports file
      Add missing dependency in Namespace/Description
      Remove unneeded exports from NAMESPACE
      Add missing comma in Imports section of DESCRIPTION
      Add missing comma in imports section of DESCRIPTION
      Rerun auto-formatter
      WIP - linting
      Add ignore rules for .lintr and .github for R build
      remove linter options from lint action as we have added .lintr project file. Fix all vector_logic_linter warnings
      Remove line length linter to see the remaining errors/warnings
      workaround for lintr bug: REditorSupport/languageserver#89
      Run auto-lint on vscode
      enable linting on build-workflow
      Add missing imports in DESCRIPTION
      ...

commit 29d82cd
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 18:40:17 2024 -0500

    Add indentation_linter configuration to lintr config file

commit 7bcfa1a
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 18:16:01 2024 -0500

    Add R_LINTR_LINTER_FILE to lint action to point to global .lintr file

commit b6df473
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 17:54:50 2024 -0500

    More lintr fixes for 1:length, 1:nrow and line length. Disabled object_length_linter

commit 6f6f91d
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 17:32:12 2024 -0500

    WIP: Fix linter warnings for 1:nrow, 1:ncol and 1:length. Increase line length to 160 chars

commit 2db2e19
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:48:59 2024 -0500

    Don't build vignettes during the release action

commit c539223
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:39:52 2024 -0500

    Move release action file to correct directory

commit f83df2b
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:36:03 2024 -0500

    Add release action

commit c84e159
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 16:04:36 2024 -0500

    Reorder imports in RcppExports file

commit 0460202
Merge: 245eaa3 43ae272
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 15:48:30 2024 -0500

    Merge branch 'build-workflow' of sciome-bot-git:Spatiotemporal-Exposures-and-Toxicology/PrestoGP into build-workflow

commit 245eaa3
Merge: 5355e24 c060815
Author: sciome-bot <software.tools@sciome.com>
Date:   Fri Jan 12 15:47:42 2024 -0500

    Merge branch 'main' of sciome-bot-git:Spatiotemporal-Exposures-and-Toxicology/PrestoGP into build-workflow

commit c060815
Merge: 731da76 6d69b69
Author: {SET}group <127860447+Spatiotemporal-Exposures-and-Toxicology@users.noreply.github.com>
Date:   Thu Jan 11 16:02:52 2024 -0500

    Merge pull request #44 from Spatiotemporal-Exposures-and-Toxicology/main-sciome

    Sciome Update 1/10/2024

... and 13 more commits
Copy link

codecov bot commented Jan 14, 2024

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@ericbair-sciome
Copy link
Collaborator

@sciome-bot @shail-choksi @ericbair-sciome Do y'all want to merge this pull request into main now or wait until other checks pass?

It looks like all tests are passing now, so please go ahead and merge. (And for the record, I checked the coverage, and essentially all of the code not covered by tests is for features that are not fully implemented yet, so that's encouraging.) R CMD check is still failing, but I'm going to work on fixing that next.

@kyle-messier kyle-messier merged commit dc0bb9d into main Jan 14, 2024
4 of 7 checks passed
@kyle-messier
Copy link
Collaborator

Do we know why the test-coverage is taking ~2 hours to run? Is it fitting GPs?

@ericbair-sciome
Copy link
Collaborator

Do we know why the test-coverage is taking ~2 hours to run? Is it fitting GPs?

Yeah, the multivariate regression models have high variance, particularly for the covariance parameter estimates. The only way I could be confident that they were producing accurate results is by fitting a model with a large sample size, which takes some time. On my machine (which is fairly fast and has an upgraded BLAS), the tests take about 30 minutes to run. Brian said that they were taking well over an hour on his laptop. I'm not sure there is a good alternative, though, since the output of prestogp_fit doesn't seem to be deterministic even if I use set.seed().

Are the tests running on a GitHub server or some local machine? You can speed things up significantly by upgrading BLAS. That may not be possible if the GitHub tests are running on the cloud somewhere. But if you/your postdocs are using Macs, you probably want to replace the default BLAS library with Apple's Accelerate BLAS library. (I can send you a link if you need instructions. It's easy to do.)

@kyle-messier
Copy link
Collaborator

@ericbair-sciome Ok - I'm glad an extensive test of the MV regression. However, I think we should highly consider an alternative CI/CA strategy for tests like that. @shail-choksi Could we set up another action that tests the long-run-time functions with another strategy instead of every pull request or merge? For example, once a day or week, or on request? So we have the standard CI/CA tests on say 95% of the code on pull/merge requests and the other strategy on the rest.

@shail-choksi
Copy link
Contributor

@Spatiotemporal-Exposures-and-Toxicology
There are 2 options we have:

  • We install openmp and increase the number of processors the action runs on to speed up the overall time
  • And/or we split the test actions into full coverage/long running and the 95% coverage/fast

@kyle-messier
Copy link
Collaborator

@Spatiotemporal-Exposures-and-Toxicology There are 2 options we have:

  • We install openmp and increase the number of processors the action runs on to speed up the overall time
  • And/or we split the test actions into full coverage/long running and the 95% coverage/fast

@shail-choksi My thought was to go with option 2, but if you recommend 1, then that is fine too.

@ericbair-sciome
Copy link
Collaborator

I don't think that multithreading is going to speed things up significantly here. And it would require some significant rewriting of the multivariate code to use multithreading at all. I would be happier to avoid that for the near future because it would require significant time and effort, and I think the multivariate code should be fast enough to analyze the pesticide data as it is. And the slow tests are responsible for covering at least 70-80% of the code. There is no way to get reasonable coverage if they are removed.

Do you have to pay for computing time on GitHub (or whatever machine runs these tests)? If not, does it even matter if the tests are slow? I doubt we are going to be doing more than 1-2 commits to GitHub per week anyway most of the time. Otherwise the only option I can think of would be to remove the tests verifying that the Matern parameter estimates are accurate. Since it is notoriously difficult to estimate variance/covariance parameters, we need a big sample size to verify that these estimates are working correctly. If we don't care about the Matern parameters and only care about the regression coefficients, a much smaller sample size should be adequate. I am reluctant to do that because I want to know if a change to the code is causing a change to the Matern parameter estimates even if we are primarily concerned with the regression coefficients. But it's an option if speeding up the tests is critical. The only option would be to just give up on running tests on GitHub and just run devtools::test() locally.

@ericbair-sciome
Copy link
Collaborator

I guess the other potential solution, as I mentioned earlier, would be to try to upgrade BLAS on whatever machine is running these tests. Using the Apple Accelerate BLAS on my MacBook or OpenBLAS on WSL, the tests only take 20-30 minutes to run.

@kyle-messier
Copy link
Collaborator

@ericbair-sciome There is no cost for the github actions since the repo is public. We can leave the tests as is for now, but perhaps change it away from the standard merge/pull request. Do y'all know the other yaml options for [on] (i.e. very beginning of the yaml file)?

@shail-choksi
Copy link
Contributor

Sorry with Option 1 - I meant to say to install BLAS not openmp.

@kyle-messier
Copy link
Collaborator

Sorry with Option 1 - I meant to say to install BLAS not openmp.

Okay, it sounds like we should do this for gh-action. Should this be included as a repo dependency too?

@shail-choksi
Copy link
Contributor

@ericbair-sciome There is no cost for the github actions since the repo is public. We can leave the tests as is for now, but perhaps change it away from the standard merge/pull request. Do y'all know the other yaml options for [on] (i.e. very beginning of the yaml file)?

i have used other options for triggering the workflows - what did you want to change it to?
Some of the relevant options are:

  • manual trigger (one of us has to trigger the workflow from the UI)
  • only runs once a tag is pushed (See release action. I assume we would want to release a fully tested version)
  • keep it as is if the run time is sped up significantly

@ericbair-sciome
Copy link
Collaborator

I would be inclined to upgrade BLAS and go from there. Hopefully that speeds things up to make it a non-issue. Having said that, if we don't want to run tests on every single commit/merge, I don't see that as a major issue. I always run devtools::test() before I commit anything anyway (and I strongly encourage others to do the same). The coverage information on GitHub is useful for me, but that isn't something that needs to be updated super often. Otherwise I don't think it's telling me anything that I wouldn't already get from devtools::test() and devtools::check().

@kyle-messier
Copy link
Collaborator

@ericbair-sciome @shail-choksi Sounds good - let's just update BLAS and let the actions be for time being. If it runs a long-time, it's not hurting anything at the moment.

@shail-choksi
Copy link
Contributor

@Spatiotemporal-Exposures-and-Toxicology great - I will start working on that then.

Also, for the release action, like I mentioned earlier, I have set it to run on a new tag push.
As an example I pushed a tag that ran this: https://github.com/Spatiotemporal-Exposures-and-Toxicology/PrestoGP/actions/runs/7509148264

That action does the following:

  • create a new release with the tag name
  • build an installable package (compressed file) for each OS and build on the latest R version
  • upload the package to the newly created release in step 1

releases are listed here: https://github.com/Spatiotemporal-Exposures-and-Toxicology/PrestoGP/releases
and the example run created this: https://github.com/Spatiotemporal-Exposures-and-Toxicology/PrestoGP/releases/tag/v0.0.1

Also, to be consistent, we should name the tags the same as the version of the package.

Let me know if you have any changes/concerns about the process above. If not, I will go ahead and delete the tag and release.

@shail-choksi
Copy link
Contributor

@Spatiotemporal-Exposures-and-Toxicology @ericbair-sciome

I tried speeding up the tests but am unable to do so

If we want to have a decent code coverage, I don't think we can remove the tests or have a small subset.

Let me know what you both think and what we should implement

@kyle-messier
Copy link
Collaborator

@ericbair-sciome @shail-choksi We can keep the tests as is for now - coverage is more important. We (NIEHS) is in the process of moving to the NIH GitHub Enterprise, so we can try different runners when that happens.

@ericbair-sciome
Copy link
Collaborator

One interesting (and rather weird) thing I noticed as I have watched this latest update in real time: It looks like the testthat tests are being run twice: once during the R-CMD-check check and once during the test-coverage check. But the R-CMD-check test is much faster. It says that the entire R-CMD-check process took 32 minutes (which includes the testthat tests). The test-coverage version of the tests is still running (almost an hour later). So maybe the covr coverage testing is slowing down the tests? I'm just speculating. As I said, it's probably not worth investing too much time or energy fixing this, but I thought it was worth mentioning. Tagging @shail-choksi just in case he has any idea what might be causing this.

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.

4 participants