Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

FYI: future_sapply() supports progress updates #424

@HenrikBengtsson

Description

@HenrikBengtsson

Background

Related to my comment in #140 (comment), I see you use:

CellChat/R/utilities.R

Lines 491 to 495 in 9dae540

my.sapply <- ifelse(
test = future::nbrOfWorkers() == 1,
yes = pbapply::pbsapply,
no = future.apply::future_sapply
)

which complicates passing argument future.seed = TRUE to future.apply::future_sapply(); it can of course be done, but it requires more work.

Suggestion

Note that the future framework supports progress updates with the progressr package - when running in sequential and parallel. This way, you don't use pbapply::pbsapply() in one case and future.apply::future_sapply() in another. You can simply use future_sapply() everywhere. See https://progressr.futureverse.org/#future_lapply---parallel-lapply for how to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions