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

UX improvements for working with metadata #119

Merged
merged 8 commits into from
Nov 22, 2023
Merged

UX improvements for working with metadata #119

merged 8 commits into from
Nov 22, 2023

Conversation

richfitz
Copy link
Member

@richfitz richfitz commented Nov 21, 2023

This deals with some of the metadata reading issues seen by Lydia when working with the malaria orderly2 project:

  • add some interactive progress bars when building metadata
  • don't read individual metadata files if we can use the data in the index (this is true most of the time)
  • try and write out the index atomically (write then move, avoids corruption on network filesystems in parallel)
  • in the unhappy situation where the index is corrupt, just throw it away

The progress bars are discussed here: https://cli.r-lib.org/articles/progress.html - they won't be shown unless rebuilding takes more than a couple of seconds, which is nice. They are however really annoying in tests so I've disabled them generally in the test setup and put in a pretty grim interaction test. I've tried this out Lydia's network sources, which take about 10-20s to read, and the behaviour is pretty good.

In a following PR I'll try out some way of writing out some mechanism faster than listing all files in the directory, which is still quite slow over the network

@richfitz richfitz marked this pull request as ready for review November 21, 2023 16:08
@richfitz richfitz requested a review from plietar November 21, 2023 16:22
Copy link

codecov bot commented Nov 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c065510) 100.00% compared to head (dc1d6cf) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #119   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           40        40           
  Lines         3513      3548   +35     
=========================================
+ Hits          3513      3548   +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -55,45 +56,59 @@ outpack_index <- R6::R6Class(
))


index_update <- function(root_path, prev, skip_cache) {
index_update <- function(root_path, prev, skip_cache, progress) {
progress <- progress %||% getOption("orderly_index_progress", TRUE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does %||% do ? Does it override progress only when null? Is that a standard thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not standard, but very common. The implementation is in util.R but also in just about every package we write (and many other people too)!

@richfitz richfitz merged commit 09ec059 into main Nov 22, 2023
9 checks passed
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.

2 participants