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

Using multidplyr within a function causes unexpected behaviour #123

Closed
avsdev-cw opened this issue Nov 10, 2021 · 2 comments
Closed

Using multidplyr within a function causes unexpected behaviour #123

avsdev-cw opened this issue Nov 10, 2021 · 2 comments

Comments

@avsdev-cw
Copy link

As per title:

cluster <- multidplyr::new_cluster(parallel::detectCores())
someFunc <- function(data, cluster) {
  data %>%
    dplyr::group_by(cyl) %>%
    multidplyr::partition(cluster) %>%
    dplyr::summarise(avg_mpg = mean(mpg)) %>%
    dplyr::collect()
}
someFunc(mtcars, cluster)

If you are lucky 2 or more cores (main+workers) will randomly get used, if not then only the main thread gets used.

@greentheo
Copy link

+1, it seems there's a lot of data copying and other things going on in the background. Would love to see this resolved.

@hadley
Copy link
Member

hadley commented Sep 25, 2022

Duplicate of #87

@hadley hadley marked this as a duplicate of #87 Sep 25, 2022
@hadley hadley closed this as completed Sep 25, 2022
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

3 participants