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

render_docs(parallel = TRUE) doesn't show counter #112

Closed
etiennebacher opened this issue Nov 21, 2023 · 1 comment
Closed

render_docs(parallel = TRUE) doesn't show counter #112

etiennebacher opened this issue Nov 21, 2023 · 1 comment

Comments

@etiennebacher
Copy link
Owner

etiennebacher commented Nov 21, 2023

Not sure how hard this would be to implement but I think there are some progress bar functionalities in future so there must be a way to share the count between processes

Also testthat can run in parallel and still counts the tests

@etiennebacher
Copy link
Owner Author

That seems quite hard to do and it looks like it's not arriving in future any time soon: futureverse/future.apply#111

If I put cli::cli_progress_step() and cli::cli_progress_update() in future_sapply() then all messages arrive at the same time when the function has finished running, which is useless. This sounds like a lot of effort for little added value, showing which man page failed to render afterwards is probably more useful.


Some code I tried, just in case:

i <- 0
conversion_worked <- vector(length = n)

if (isTRUE(parallel)) {
  .assert_dependency("future.apply", install = TRUE)
  conversion_worked <- future.apply::future_sapply(
    seq_along(man_source),
    function(x) {
      cli::cli_progress_step("Converting function reference {i}/{n}: {basename(man_source[i])}", spinner = TRUE)
      conversion_worked[x] <<- render_one_man(man_source[x])
      cli::cli_progress_update(inc = 1)
    },
    future.seed = NULL,
    future.conditions = "message"
  )
} else {
  cli::cli_progress_step("Converting function reference {i}/{n}: {basename(man_source[i])}", spinner = TRUE)
  for (i in seq_along(man_source)) {
    conversion_worked[i] <- render_one_man(man_source[i])
    cli::cli_progress_update(inc = 1)
  }
}

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

No branches or pull requests

1 participant