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

Question: cleanup() vs finalize() #91

Closed
wlandau opened this issue Jul 18, 2018 · 1 comment
Closed

Question: cleanup() vs finalize() #91

wlandau opened this issue Jul 18, 2018 · 1 comment

Comments

@wlandau
Copy link
Contributor

wlandau commented Jul 18, 2018

In your example code in #86 (comment), you have an on.exit(w$cleanup()) line. The cleanup() method does not work for me, but finalize() does. What is the difference, and which one should I use?

library(clustermq)
#> * Option 'clustermq.scheduler' not set, defaulting to SGE
#> --- see: https://github.com/mschubert/clustermq/wiki#setting-up-the-scheduler
w <- workers(2)
#> Submitting 2 worker jobs (ID: 7504) ...
w$cleanup()
#> Error in max(sapply(private$worker_stats, function(w) w$mem)) :
#>  invalid 'type' (list) of argument
traceback()
#> 3: self$summary_stats()
#> 2: super$cleanup()
#> 1: w$cleanup()
w$finalize() # Also appears to work with `clean = TRUE`.
#> <censored> has registered the job-array task 33180389.1 for deletion
#> <censored> has registered the job-array task 33180389.2 for deletion
@mschubert
Copy link
Owner

cleanup() is supposed to be a proper shutdown (telling each worker individually to end its process), while finalize() is a kill.

I'd recommend to use cleanup() and not touch finallize(). on.exit() is set automatically for the finalizer. The error on cleanup() should be fixed now.

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

2 participants