You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll admit, this is a bit weird, so please bear with me. I've been trying to make code so that when a remote future is resolved, a beep (simply beepr::beep()) will play.
but I'd like to have it so that I'd be able to use the console for other things in the meantime.
My first thought was to make another future to take care of this, but the only future I found that would play audio over my computer was multisession, like so:
I also realized that you can't pass a future to another future (to check and wait until the first is resolved before beeping), so my next plan was to make a function that would take an expression, temporarily wrap the current plan in a multisession plan, embed the expression in another future and wait for the embedded future to resolve, make a ding, and then resolve the multisession future.
Unfortunately, I realize that the recommended
oplan<- plan()
on.exit(plan(oplan), add=TRUE)
bit would screw things up, since once the function had made the assignment, the multisession plan would be changed to what it was previously, and doing so would basically kill the multisession future. I.e.:
(Oddly enough, switching the placement of plan(multisession) and plan(multicore)doesn't cause the same error, presumably because of something with multicore not using the same kind of connections?)
Anyway, is it somehow possible to get a plan that will keep running its code even if you switch to a different plan? Barring that, is there anything I can do to get a "beep on resolution" that lets me not have to permanently alter the current global plan?
Thanks!
The text was updated successfully, but these errors were encountered:
I'll admit, this is a bit weird, so please bear with me. I've been trying to make code so that when a remote future is resolved, a beep (simply
beepr::beep()
) will play.I could obviously do:
but I'd like to have it so that I'd be able to use the console for other things in the meantime.
My first thought was to make another future to take care of this, but the only future I found that would play audio over my computer was
multisession
, like so:I also realized that you can't pass a future to another future (to check and wait until the first is resolved before beeping), so my next plan was to make a function that would take an expression, temporarily wrap the current plan in a multisession plan, embed the expression in another future and wait for the embedded future to resolve, make a ding, and then resolve the multisession future.
Unfortunately, I realize that the recommended
bit would screw things up, since once the function had made the assignment, the multisession plan would be changed to what it was previously, and doing so would basically kill the multisession future. I.e.:
(Oddly enough, switching the placement of
plan(multisession)
andplan(multicore)
doesn't cause the same error, presumably because of something with multicore not using the same kind of connections?)Anyway, is it somehow possible to get a plan that will keep running its code even if you switch to a different plan? Barring that, is there anything I can do to get a "beep on resolution" that lets me not have to permanently alter the current global plan?
Thanks!
The text was updated successfully, but these errors were encountered: