-
Notifications
You must be signed in to change notification settings - Fork 11
[Feature Request] return mirai objects from everywhere()
#164
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
Comments
For the time being, I did something really hacky to return the vector of https://github.com/shikokuchuo/mirai/blob/92afc179be94781973e1a709cf24b0694c1018b6/R/mirai.R#L268 - invisible()
+ invisible(vec) # modify `everywhere()` to return `vec`
everywhere <- mirai::everywhere
body(everywhere) <- bquote({ .(body(everywhere)); invisible(vec) })
ms <- mirai::collect_mirai(everywhere({
do_flaky_web_request()
"success"
}))
if (any(is_error <- vapply(ms, mirai::is_mirai_error, logical(1L)))) {
stop("issues encountered during daemon setup")
} This let me terminate early when anything goes wrong. In practice, I can also expose things like individual node error messages and stack traces stored in the Although modifying a function body is a last resort, I was impressed by how simple the change was. |
Thanks Doug. I'm persuaded of the benefits of your request. Leave this with me - it may take some time as I might be updating the underlying implementation (currently comprised of mirai calls) - and I don't want to be changing the API too often. |
This has been incorporated now in mirai 1.3.1.9022 (what will be mirai v2). |
Uh oh!
There was an error while loading. Please reload this page.
I've finally landed on a good project for experimenting with
mirai
and I've been super impressed.All was going well until I started getting errors in some code I was calling with
everywhere()
. Not any issue withmirai
directly - it turns out a web request I needed to make from each node was starting to error due to some server downtime. To debug the issues ineverywhere()
, I had to re-write it as singlemirai()
call to inspect the result.It would be helpful if
everywhere()
returned a list ofmirai
objects similar tomirai_map
. This would allow me to build some checks into my scripts for situations where successful execution relies on external factors.The text was updated successfully, but these errors were encountered: